Skip to content

Commit 1baae28

Browse files
committed
GitHub: Tooltipped links (e.g. authors and labels in issue listings) no longer incorrectly get the tooltip as their label.
1 parent 97e5a28 commit 1baae28

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

GitHubA11yFixes.user.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ function onNodeAdded(target) {
6060
elem.setAttribute("role", "cell");
6161
for (elem of target.querySelectorAll(".markdown-body td"))
6262
elem.setAttribute("role", "cell");
63+
// Tooltipped links (e.g. authors and labels in issue listings) shouldn't get the tooltip as their label.
64+
for (elem of target.querySelectorAll("a.tooltipped")) {
65+
if (!elem.textContent || /^\s+$/.test(elem.textContent))
66+
continue;
67+
var tooltip = elem.getAttribute("aria-label");
68+
// This will unfortunately change the visual presentation.
69+
elem.setAttribute("title", tooltip);
70+
elem.removeAttribute("aria-label");
71+
}
6372
}
6473

6574
function onClassModified(target) {

0 commit comments

Comments
 (0)