Skip to content

Commit c30fc60

Browse files
committed
GitHub: Fix table lists in issue listings, etc. broken (again!) by recent GitHub update.
Fixes #2.
1 parent b7e6aef commit c30fc60

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

GitHubA11yFixes.user.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,19 @@ function onNodeAdded(target) {
106106
// Table lists; e.g. in issue and commit listings.
107107
for (elem of target.querySelectorAll(".table-list,.Box-body"))
108108
elem.setAttribute("role", "table");
109-
for (elem of target.querySelectorAll(".d-table"))
110-
elem.setAttribute("role", "presentation");
111109
for (elem of target.querySelectorAll(".table-list-item,.Box-body-row"))
112110
elem.setAttribute("role", "row");
113-
for (elem of target.querySelectorAll(".table-list-cell,.d-table-cell"))
111+
for (elem of target.querySelectorAll(".d-table")) {
112+
// There's one of these inside every .Box-body-row.
113+
// It's purely presentational.
114+
elem.setAttribute("role", "presentation");
115+
// Its children are the cells, but they have no common class.
116+
for (elem of elem.children)
117+
elem.setAttribute("role", "cell");
118+
}
119+
for (elem of target.querySelectorAll(".table-list-cell"))
114120
elem.setAttribute("role", "cell");
115-
// Tables in Markdwn content get display: block, which causes them not to be treated as tables.
121+
// Tables in Markdown content get display: block, which causes them not to be treated as tables.
116122
for (elem of target.querySelectorAll(".markdown-body table"))
117123
elem.setAttribute("role", "table");
118124
for (elem of target.querySelectorAll(".markdown-body tr"))

0 commit comments

Comments
 (0)