-
Notifications
You must be signed in to change notification settings - Fork 17
/
BugzillaA11yFixes.user.js
38 lines (32 loc) · 1.1 KB
/
BugzillaA11yFixes.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// ==UserScript==
// @name Bugzilla Accessibility Fixes
// @namespace http://www.jantrid.net/axSGrease/
// @description Improves the accessibility of Bugzilla.
// @author James Teh <[email protected]>
// @copyright 2014 James Teh
// @license GNU General Public License version 2.0
// @version 2014.1.1
// @include */show_bug.cgi?*
// @include */process_bug.cgi
// ==/UserScript==
function makeHeading(elem, level) {
elem.setAttribute("role", "heading");
elem.setAttribute("aria-level", level);
}
function tweak() {
var elem = document.getElementById("short_desc_nonedit_display");
if (!elem)
return; // Not a Bugzilla bug.
// Bug title.
makeHeading(elem, 1);
// Attachments heading.
if (elem = document.getElementById("attachment_table"))
makeHeading(elem.rows[0].cells[0], 2);
// Comment numbers.
for (elem of document.getElementsByClassName("bz_comment_number"))
makeHeading(elem, 2);
// Label user images.
for (elem of document.querySelectorAll("span.bz_comment_user a img"))
elem.setAttribute("alt", "User image");
}
tweak();