diff --git a/js/profile-w3c-common.js b/js/profile-w3c-common.js index 1af249e943..8aca370289 100644 --- a/js/profile-w3c-common.js +++ b/js/profile-w3c-common.js @@ -65,7 +65,6 @@ define( "w3c/permalinks", "core/id-headers", "core/rdfa", - "w3c/aria", "core/location-hash", "ui/about-respec", "ui/dfn-list", diff --git a/src/core/issues-notes.js b/src/core/issues-notes.js index 9191bc79bf..3b6015a2e5 100644 --- a/src/core/issues-notes.js +++ b/src/core/issues-notes.js @@ -10,7 +10,6 @@ // numbered to avoid involuntary clashes. // If the configuration has issueBase set to a non-empty string, and issues are // manually numbered, a link to the issue is created using issueBase and the issue number - import { pub } from "core/pubsubhub"; import css from "deps/text!core/css/issues-notes.css"; import { fetch as ghFetch, fetchIndex } from "core/github"; @@ -54,7 +53,7 @@ export function run(conf, doc, cb) { "'>" ), $tit = $( - "
" + "
" ), text = isIssue ? isFeatureAtRisk ? "Feature at Risk" : conf.l10n.issue @@ -62,6 +61,7 @@ export function run(conf, doc, cb) { ? conf.l10n.warning : isEdNote ? conf.l10n.editors_note : conf.l10n.note, ghIssue; + $tit.makeID("h", report.type); report.title = $inno.attr("title"); if (isIssue) { if (hasDataNum) { @@ -123,6 +123,8 @@ export function run(conf, doc, cb) { body = ghIssue.body_html; } $div.append(body); + const level = $tit.parents("section").length + 2; + $tit.attr("aria-level", level); } pub(report.type, report); }); diff --git a/src/w3c/aria.js b/src/w3c/aria.js deleted file mode 100644 index 59277d2b0d..0000000000 --- a/src/w3c/aria.js +++ /dev/null @@ -1,42 +0,0 @@ -// Module w3c/aria -// Adds wai-aria landmarks and roles to entire document. -// Introduced by Shane McCarron (shane@aptest.com) from the W3C PFWG -export const name = "w3c/aria"; -export function run(conf, doc, cb) { - // ensure head section is labeled - if (!doc.body.hasAttribute("id")) { - doc.body.setAttribute("id", "respecDocument"); - } - var head = document.querySelector("div.head"); - if (head) { - head.setAttribute("role", "contentinfo"); - head.setAttribute("id", "respecHeader"); - } - var toc = doc.querySelector("#toc ol:first-of-type"); - if (toc) { - // ensure toc is labeled - toc.setAttribute("role", "directory"); - } - // mark issues and notes with heading - var noteCount = 1; - var issueCount = 1; - var ednoteCount = 1; - Array.from( - doc.querySelectorAll(".note-title, .ednote-title, .issue-title") - ).forEach(function(element) { - var $element = $(element); - var isIssue = element.classList.contains("issue-title"); - var isEdNote = element.classList.contains("ednote-title"); - var level = $element.parents("section").length + 2; - element.setAttribute("aria-level", level); - element.setAttribute("role", "heading"); - if (isIssue) { - $element.makeID("h", "issue" + issueCount++); - } else if (isEdNote) { - $element.makeID("h", "ednote" + ednoteCount++); - } else { - $element.makeID("h", "note" + noteCount++); - } - }); - cb(); -} diff --git a/tests/spec/w3c/headers-spec.js b/tests/spec/w3c/headers-spec.js index 3b723fb647..0762a30fe2 100644 --- a/tests/spec/w3c/headers-spec.js +++ b/tests/spec/w3c/headers-spec.js @@ -180,7 +180,7 @@ describe("W3C — Headers", function() { var orcidAnchor = doc.querySelector("a[href='" + oricdHref + "']"); var twitterAnchor = doc.querySelector("a[href='" + twitterHref + "']"); // general checks - var header = doc.querySelector("#respecHeader"); + var header = doc.querySelector("div.head"); [orcidAnchor, twitterAnchor].forEach(function(elem) { // Check parent is correct. expect(elem.parentNode.localName).toEqual("span"); @@ -343,7 +343,7 @@ describe("W3C — Headers", function() { }; Object.assign(ops.config, newProps); const doc = await makeRSDoc(ops); - var licenses = doc.querySelectorAll("#respecHeader a[rel=license]"); + var licenses = doc.querySelectorAll("div.head a[rel=license]"); expect(licenses.length).toEqual(1); expect(licenses.item(0).tagName).toEqual("A"); expect(licenses.item(0).href).toEqual(