Skip to content

Commit

Permalink
doc: add main ARIA landmark to API docs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott committed Sep 28, 2023
1 parent f416a0f commit bc056c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1>Node.js __VERSION__ documentation</h1>

__TOC__

<div id="apicontent">
<div role="main" id="apicontent">
__CONTENT__
<!-- API END -->
</div>
Expand Down
4 changes: 2 additions & 2 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for (const link of toc.match(/<a.*?>/g)) {
const data = fs.readFileSync(new URL(`./${href}`, source), 'utf8');

// 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
const moduleName = href.replace(/\.html$/, '');
Expand Down Expand Up @@ -89,7 +89,7 @@ all = all.slice(0, tocStart.index + tocStart[0].length) +
all.slice(tocStart.index + tocStart[0].length);

// 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 -->');
all = all.slice(0, apiStart.index + apiStart[0].length)
.replace(
Expand Down

0 comments on commit bc056c2

Please sign in to comment.