mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: add main ARIA landmark to API docs
As an accessibility improvement, specify the main landmark for the column in our docs that contains the main content. Ref: https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/ Ref: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA20.html PR-URL: https://github.com/nodejs/node/pull/49882 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Claudio Wunder <cwunder@gnome.org> Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
__TOC__
|
__TOC__
|
||||||
|
|
||||||
<div id="apicontent">
|
<div role="main" id="apicontent">
|
||||||
__CONTENT__
|
__CONTENT__
|
||||||
<!-- API END -->
|
<!-- API END -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ for (const link of toc.match(/<a.*?>/g)) {
|
|||||||
const data = fs.readFileSync(new URL(`./${href}`, source), 'utf8');
|
const data = fs.readFileSync(new URL(`./${href}`, source), 'utf8');
|
||||||
|
|
||||||
// Split the doc.
|
// Split the doc.
|
||||||
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
|
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ role="main" id="apicontent">/.exec(data);
|
||||||
|
|
||||||
// Get module name
|
// Get module name
|
||||||
const moduleName = href.replace(/\.html$/, '');
|
const moduleName = href.replace(/\.html$/, '');
|
||||||
@@ -89,7 +89,7 @@ all = all.slice(0, tocStart.index + tocStart[0].length) +
|
|||||||
all.slice(tocStart.index + tocStart[0].length);
|
all.slice(tocStart.index + tocStart[0].length);
|
||||||
|
|
||||||
// Replace apicontent with the concatenated set of apicontents from each source.
|
// Replace apicontent with the concatenated set of apicontents from each source.
|
||||||
const apiStart = /<\w+ id="apicontent">\s*/.exec(all);
|
const apiStart = /<\w+ role="main" id="apicontent">\s*/.exec(all);
|
||||||
const apiEnd = all.lastIndexOf('<!-- API END -->');
|
const apiEnd = all.lastIndexOf('<!-- API END -->');
|
||||||
all = all.slice(0, apiStart.index + apiStart[0].length)
|
all = all.slice(0, apiStart.index + apiStart[0].length)
|
||||||
.replace(
|
.replace(
|
||||||
|
|||||||
Reference in New Issue
Block a user