Skip to content

Commit ca16b5d

Browse files
committed
GoogleCode: Make headings for the issue title, description and comments, similar to what was done for Bugzilla.
1 parent 124e932 commit ca16b5d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

GoogleCodeA11yFixes.user.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// @author James Teh <jamie@nvaccess.org>
66
// @copyright 2014 James Teh
77
// @license GNU General Public License version 2.0
8-
// @version 0.20140214.01
8+
// @version 2014.1
99
// @include https://code.google.com/p/*/issues/*
1010
// ==/UserScript==
1111

@@ -15,6 +15,25 @@ function fixStar(node) {
1515
(node.src.indexOf("star_on.gif") == -1) ? "false" : "true");
1616
}
1717

18+
function makeHeading(elem, level) {
19+
elem.setAttribute("role", "heading");
20+
elem.setAttribute("aria-level", level);
21+
}
22+
23+
function makeHeadings() {
24+
// Title.
25+
var elem = document.querySelector("#issueheader span.h3");
26+
makeHeading(elem, 1);
27+
28+
// Description and comments.
29+
for (elem of document.getElementsByClassName("author"))
30+
makeHeading(elem, 2);
31+
32+
// Make changes heading.
33+
var elem = document.querySelector("#makechanges div.h4");
34+
makeHeading(elem, 2);
35+
}
36+
1837
var observer = new MutationObserver(function(mutations) {
1938
mutations.forEach(function(mutation) {
2039
try {
@@ -30,4 +49,6 @@ var observer = new MutationObserver(function(mutations) {
3049
});
3150
observer.observe(document, {attributes: true,
3251
subtree: true, attributeFilter: ["src"]});
52+
3353
fixStar(document.getElementById("star"));
54+
makeHeadings();

0 commit comments

Comments
 (0)