Skip to content

Commit cc89ffa

Browse files
committed
GitHub: Make issue listings and Markdown tables accessible as tables.
1 parent fdf3f27 commit cc89ffa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

GitHubA11yFixes.user.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,34 @@ function onNodeAdded(target) {
3939
}
4040

4141
// Site-wide stuff.
42+
// Checkable menu items; e.g. in watch and labels pop-ups.
4243
for (elem of target.querySelectorAll(".select-menu-item")) {
4344
elem.setAttribute("role", "menuitem");
4445
onSelectMenuItemChanged(elem);
4546
}
47+
// Table lists; e.g. in issue listings.
48+
for (elem of target.querySelectorAll(".table-list"))
49+
elem.setAttribute("role", "table");
50+
for (elem of target.querySelectorAll(".table-list-item"))
51+
elem.setAttribute("role", "row");
52+
for (elem of target.querySelectorAll(".table-list-cell"))
53+
elem.setAttribute("role", "cell");
54+
// Tables in Markdwn content get display: block, which causes them not to be treated as tables.
55+
for (elem of target.querySelectorAll(".markdown-body table"))
56+
elem.setAttribute("role", "table");
57+
for (elem of target.querySelectorAll(".markdown-body tr"))
58+
elem.setAttribute("role", "row");
59+
for (elem of target.querySelectorAll(".markdown-body th"))
60+
elem.setAttribute("role", "cell");
61+
for (elem of target.querySelectorAll(".markdown-body td"))
62+
elem.setAttribute("role", "cell");
4663
}
4764

4865
function onClassModified(target) {
4966
var classes = target.classList;
5067
if (!classes)
5168
return;
69+
// Checkable menu items; e.g. in watch and labels pop-ups.
5270
if (classes.contains("select-menu-item"))
5371
onSelectMenuItemChanged(target);
5472
}

0 commit comments

Comments
 (0)