Skip to content

Commit 72e40b5

Browse files
committed
Trello: Fix problem where cards were not list items or focusable when added during the session (as opposed to cards that already existed on page load).
1 parent 9d5bd86 commit 72e40b5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

TrelloA11yFixes.user.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@
1313
// Used when we need to generate ids for ARIA.
1414
var idCounter = 0;
1515

16+
function tweakCard(card) {
17+
// Make this a focusable list item.
18+
card.setAttribute("tabindex", "-1");
19+
card.setAttribute("role", "listitem");
20+
}
21+
1622
function onNodeAdded(target) {
23+
if (target.classList.contains("list-card")) {
24+
// A card just got added.
25+
tweakCard(target);
26+
return;
27+
}
1728
if (target.classList.contains("badge")) {
1829
// Label badges.
1930
var label = target.getAttribute("title");
@@ -33,9 +44,7 @@ function onNodeAdded(target) {
3344
}
3445
}
3546
for (var card of target.querySelectorAll(".list-card")) {
36-
// Make this a focusable list item.
37-
card.setAttribute("tabindex", "-1");
38-
card.setAttribute("role", "listitem");
47+
tweakCard(card);
3948
}
4049
}
4150

0 commit comments

Comments
 (0)