doc: keep sidebar module visible when navigating docs

PR-URL: https://github.com/nodejs/node/pull/60410
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Botato 2025-11-23 13:20:07 +00:00 committed by GitHub
parent 1758b74829
commit aa948fdbd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -187,6 +187,20 @@
});
}
function setupSidebarScroll() {
const sidebarLinks = document.querySelectorAll('#column2 a');
let link;
for (link of sidebarLinks) {
if (link.pathname === window.location.pathname) break;
}
if (!link) return;
link.scrollIntoView({ block: 'center' });
}
function bootstrap() {
// Check if we have JavaScript support.
document.documentElement.classList.add('has-js');
@ -206,6 +220,8 @@
setupFlavorToggles();
setupCopyButton();
setupSidebarScroll();
}
if (document.readyState === 'loading') {