Skip to content

docs: pin the left nav from 960px wide, with a button to hide it - #344

Merged
jeyrb merged 1 commit into
mainfrom
docs-pinned-nav
Nov 25, 2026
Merged

jeyrb merged 1 commit into
mainfrom
docs-pinned-nav

Conversation

@jeyrb

@jeyrb jeyrb commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

The docs theme (MaterialX) only pins the left navigation from 1220px wide. Below that it sits behind the hamburger menu, so on many laptop windows the docs show no navigation at all. The theme has no setting for that width or for collapsing the sidebar, so:

  • docgen/sidebar_breakpoint.py: a post-build hook that moves the theme's breakpoint from 76.25em (1220px) to 60em (960px), in both its stylesheet and its JavaScript, which uses the same width to position the sidebar. It logs a warning if a future theme version no longer has those values.
  • docs/javascripts/nav_toggle.js: a header button, in the hamburger's place, labelled "Hide navigation" or "Show navigation". The choice is remembered between pages and visits, and docs/overrides/main.html applies it before the page draws, so the nav doesn't flash.
  • docs/assets/stylesheets/extra.css: shows the button only where the nav is pinned, and moves the earlier "keep top tabs visible" rule to the new width.

Below 960px nothing changes: hamburger and slide-out menu as before.

Test plan

  • Build rewrites both theme assets (no 76.25em left in either)
  • At 1046px in Chrome: nav pinned and sized by the theme's JS, so it scrolls on its own; button shown, hamburger hidden
  • Hiding: content widens; stays hidden after reload and after instant navigation to another page; showing it again works
  • At 796px: hamburger and drawer as before, button hidden
  • prek run passes

Not changed: the nav still lists only the current top tab's section, and the button label is English only.

🤖 Generated with Claude Code

The theme only pins the navigation sidebar from 1220px, leaving it behind
the hamburger menu on narrower windows, and has no setting for that or
for collapsing it. A build hook moves the breakpoint to 60em in the
theme's stylesheet and JavaScript, and a header button hides the
sidebar, remembered between pages and visits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeyrb
jeyrb merged commit 3073975 into main Nov 25, 2026
19 of 20 checks passed
@jeyrb
jeyrb deleted the docs-pinned-nav branch November 25, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant