Skip to content

Commit 4829d97

Browse files
Trottaduh95
authored andcommittedFeb 10, 2025
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: #49882 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Claudio Wunder <cwunder@gnome.org> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent 6c4ce1f commit 4829d97

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎doc/template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h1>Node.js __VERSION__ documentation</h1>
7070

7171
__TOC__
7272

73-
<div id="apicontent">
73+
<div role="main" id="apicontent">
7474
__CONTENT__
7575
<!-- API END -->
7676
</div>

‎tools/doc/allhtml.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const link of toc.match(/<a.*?>/g)) {
2727
const data = fs.readFileSync(new URL(`./${href}`, source), 'utf8');
2828

2929
// Split the doc.
30-
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
30+
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ role="main" id="apicontent">/.exec(data);
3131

3232
// Get module name
3333
const moduleName = href.replace(/\.html$/, '');
@@ -89,7 +89,7 @@ all = all.slice(0, tocStart.index + tocStart[0].length) +
8989
all.slice(tocStart.index + tocStart[0].length);
9090

9191
// Replace apicontent with the concatenated set of apicontents from each source.
92-
const apiStart = /<\w+ id="apicontent">\s*/.exec(all);
92+
const apiStart = /<\w+ role="main" id="apicontent">\s*/.exec(all);
9393
const apiEnd = all.lastIndexOf('<!-- API END -->');
9494
all = all.slice(0, apiStart.index + apiStart[0].length)
9595
.replace(

0 commit comments

Comments
 (0)
Please sign in to comment.