Skip to content

Commit c6dcd56

Browse files
committed
Trello: Make activity item headers accessible as headings.
1 parent e63692c commit c6dcd56

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

TrelloA11yFixes.user.js

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

16+
function makeHeading(elem, level) {
17+
elem.setAttribute("role", "heading");
18+
elem.setAttribute("aria-level", level);
19+
}
20+
1621
function tweakCard(card) {
1722
// Make this a focusable list item.
1823
card.setAttribute("tabindex", "-1");
@@ -48,13 +53,17 @@ function onNodeAdded(target) {
4853
header.setAttribute("id", id);
4954
list.setAttribute("aria-labelledby", id);
5055
// Make the header's container into a heading.
51-
header.parentNode.setAttribute("role", "heading");
52-
header.parentNode.setAttribute("aria-level", "2");
56+
makeHeading(header, 2);
5357
}
5458
}
5559
for (var card of target.querySelectorAll(".list-card")) {
5660
tweakCard(card);
5761
}
62+
for (var activityCreator of target.querySelectorAll(".phenom-creator")) {
63+
// Make the creator of an activity item into a heading
64+
// to facilitate quick jumping between activity items.
65+
makeHeading(activityCreator, 4);
66+
}
5867
}
5968

6069
function onClassModified(target) {

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ It does the following:
9595
If you are using a screen reader, you will need to ensure that the arrow keys are passed to the application to make use of this.
9696
For NVDA, you can achieve this by switching to focus mode to move through cards.
9797
- Labels badges in cards.
98-
- Makes list headers accessible as headings.
98+
- Makes list headers and activity item headers accessible as headings.
9999
- Prevents loss of position for screen reader users when pressing the control key.
100100
- Adds a shift+m keyboard shortcut to quickly move a card.

0 commit comments

Comments
 (0)