Docs: Fixed some bugs int he ToC's javascript
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / security (push) Waiting to run
CI / quality (push) Waiting to run
CI / unit_tests (push) Waiting to run
CI / integration_tests (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions

This commit is contained in:
2026-02-16 19:26:49 -05:00
parent 155a5d7819
commit ea76990bb6
2 changed files with 66 additions and 15 deletions
+13 -9
View File
@@ -74,15 +74,19 @@
userPinned.clear();
autoExpanded.clear();
// Mark all nav roots so CSS can scope styles
sidebar.querySelectorAll("nav.md-nav").forEach(function (nav) {
nav.classList.add("md-nav--integrated");
});
// Find every <li> inside the actual TOC (md-nav--secondary) that has
// nested children. We scope to the secondary nav to avoid touching the
// page-level nav item that wraps the TOC — that item contains a <label>
// for the mobile TOC toggle and would show up as a bogus duplicate entry.
// Find the actual TOC (md-nav--secondary). We scope to the secondary
// nav to avoid touching the page-level nav items that wrap sections —
// those use Material's native checkbox-based toggle and should not be
// overridden.
//
// NOTE: The primary nav already has .md-nav--integrated added by
// mkdocs-material when the toc.integrate feature is enabled. We do
// NOT re-add that class or extend it to descendant navs — doing so
// causes the CSS rule ".md-nav--integrated .md-nav__item--nested >
// .md-nav { display: block }" to override Material's native
// checkbox-based collapse on primary nav sections (Reference,
// Development, Architecture Decisions, etc.), creating whitespace
// below collapsed section headings.
var tocNav = sidebar.querySelector("nav.md-nav--secondary");
if (!tocNav) return;