Skip to content

Commit 4959d94

Browse files
committed
fix: add descriptive alt text to project card images for accessibility
1 parent bf108db commit 4959d94

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

web-app/js/main.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ═══════════════════════════════════════════════════════════════
2-
main.js — App wiring for Premium Python Projects Gallery
2+
main.js — App wiring for Premium Python Projects Gallery
33
═══════════════════════════════════════════════════════════════ */
44

55
import { updateProjectVisibility } from "./modules/utils.js";
@@ -911,10 +911,18 @@ document.addEventListener("DOMContentLoaded", function () {
911911
var iconBox = document.createElement("div");
912912
iconBox.className = "dropdown-item-icon";
913913
var banner = project.card.querySelector(".card-banner");
914+
projectCards.forEach(function(card) {
915+
var banner = card.querySelector(".card-banner");
916+
var title = card.querySelector("h3");
917+
918+
if (banner && title) {
919+
banner.alt = title.textContent.trim() + " project preview";
920+
}
921+
});
914922
if (banner) {
915923
var img = document.createElement("img");
916924
img.src = banner.src;
917-
img.alt = "";
925+
img.alt = project.title + " project preview";
918926
iconBox.appendChild(img);
919927
}
920928

0 commit comments

Comments
 (0)