Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jan 24, 2025
1 parent 02c3806 commit d819a11
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 5 additions & 2 deletions doc/api_assets/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
function closeAllPickers() {
for (const picker of pickers) {
picker.parentNode.classList.remove('expanded');
picker.ariaExpanded = false;
}

window.removeEventListener('click', closeAllPickers);
Expand All @@ -57,15 +58,16 @@

for (const picker of pickers) {
const parentNode = picker.parentNode;


Check failure on line 61 in doc/api_assets/api.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Trailing spaces not allowed
picker.ariaExpanded = parentNode.classList.contains('expanded');
picker.addEventListener('click', function(e) {
e.preventDefault();

/*
closeAllPickers as window event trigger already closed all the pickers,
if it already closed there is nothing else to do here
*/
if (parentNode.classList.contains('expanded')) {
if (picker.ariaExpanded === 'true') {
return;
}

Expand All @@ -75,6 +77,7 @@
*/

requestAnimationFrame(function() {
picker.ariaExpanded = true;
parentNode.classList.add('expanded');
window.addEventListener('click', closeAllPickers);
window.addEventListener('keydown', onKeyDown);
Expand Down
4 changes: 2 additions & 2 deletions doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ <h1>Node.js __VERSION__ documentation</h1>
__GTOC_PICKER__
__ALTDOCS__
<li class="picker-header">
<a href="#">
<a href="#options-picker" aria-controls="options-picker">
<span class="picker-arrow"></span>
Options
</a>

<div class="picker" tabindex="-1">
<ul>
<ul id="options-picker">
<li>
<a href="all.html">View on single page</a>
</li>
Expand Down
10 changes: 5 additions & 5 deletions tools/doc/html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ function altDocs(filename, docCreated, versions) {

return list ? `
<li class="picker-header">
<a href="#">
<a href="#alt-docs" aria-controls="alt-docs">
<span class="picker-arrow"></span>
Other versions
</a>
Expand Down Expand Up @@ -557,12 +557,12 @@ function gtocPicker(id) {

return `
<li class="picker-header">
<a href="#">
<a href="#gtoc-picker" aria-controls="gtoc-picker">
<span class="picker-arrow"></span>
Index
</a>
<div class="picker" tabindex="-1">${gtoc}</div>
<div class="picker" tabindex="-1" id="gtoc-picker">${gtoc}</div>
</li>
`;
}
Expand All @@ -574,12 +574,12 @@ function tocPicker(id, content) {

return `
<li class="picker-header">
<a href="#">
<a href="#toc-picker" aria-controls="toc-picker">
<span class="picker-arrow"></span>
Table of contents
</a>
<div class="picker" tabindex="-1">${content.tocPicker}</div>
<div class="picker" tabindex="-1">${content.tocPicker.replace('<ul>', '<ul id="toc-picker">')}</div>
</li>
`;
}

0 comments on commit d819a11

Please sign in to comment.