Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc, tools: add ARIA landmarks to API docs #49882

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</head>
<body class="alt apidoc" id="api-section-__FILENAME__">
<div id="content" class="clearfix">
<div id="column2" class="interior">
<div role="navigation" id="column2" class="interior">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
Node.js
Expand Down 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
2 changes: 1 addition & 1 deletion tools/doc/html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export function buildToc({ filename, apilinks }) {
.use(htmlStringify)
.processSync(toc).toString();

file.toc = `<details id="toc" open><summary>Table of contents</summary>${inner}</details>`;
file.toc = `<details role="navigation" id="toc" open><summary>Table of contents</summary>${inner}</details>`;
file.tocPicker = `<div class="toc">${inner}</div>`;
} else {
file.toc = file.tocPicker = '<!-- TOC -->';
Expand Down