Skip to content

Highlight the current page in the sidebar and scroll it into view - #1265

Merged
willeastcott merged 2 commits into
mainfrom
feat/sidebar-current-page
Oct 3, 2026
Merged

willeastcott merged 2 commits into
mainfrom
feat/sidebar-current-page

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Makes the current page easy to find in the User Manual sidebar. Only the current page is highlighted now, and the sidebar scrolls to it after each navigation. Follows #1264.

What changed

Current page highlight (src/css/custom.scss)

  • The categories above the current page drop the orange. They keep the normal text colour in semibold, so they read as a trail to the page.
  • The current page gets an orange-tinted background with orange text. In light mode that's #a84300 on the tint (4.8:1; the old orange on grey was 1.86:1). In dark mode it's the existing #ffb47a (7.3:1).
  • On a category page, the whole row is tinted, chevron included.
  • Hovered items keep the grey background, so a hovered item no longer looks like the current page.

Scroll to the current page (src/client-modules/reveal-current-page.js, registered in docusaurus.config.js)

  • After each navigation, the sidebar scrolls so the current entry is centred, but only when it's out of view. Clicking an entry you can see never moves the list, and hash changes on the same page are ignored.
  • The mobile drawer's sidebar is rendered while the drawer is closed, so it gets scrolled too, and the drawer opens on the current page.
  • Categories animate open and closed, and auto-collapse can fold a category above the entry, so the module keeps checking for one second after each navigation. It stops as soon as the reader scrolls, taps or types.

Why

Every category above the current page turned orange along with the page itself, and the current page used the same grey background as a hovered item. The page you were on was the hardest entry to spot. The sidebar also never scrolled on its own, so arriving on a deep page from search or a link left its entry out of sight. Text to Splats, for example, sat 1,334 px down an 840 px sidebar.

Testing

  • npm run build succeeds for en and ja with no warnings
  • npm run lint is clean, and npm test passes (52 tests)
  • Checked the served build in Chrome, in light and dark:
    • First loads of Text to Splats, <pc-entity> and Editor › Editor Interface › Project Settings › Rendering centre the entry. The Welcome page doesn't scroll
    • The content link from Building a Scene to <pc-entity> (a client-side navigation) brings the entry into view
    • A table of contents link leaves the sidebar where the reader put it
    • Clicking the visible Getting Started entry doesn't move the list
    • Clicking Physics low in the list, while Graphics auto-collapses above it, keeps Physics in view
    • Scrolling with the mouse wheel during the one-second window stops the adjustment
    • On mobile, the drawer opens on the current page, including after navigating from inside the drawer
  • There are no new console errors. On mobile, React error Add page on shader chunk migrations #418 still appears intermittently, as it does on production (3 of 5 loads). Fix React #418 hydration errors and keep the copy-page button after navigation #1261 fixes it

Notes for review

  • Fix React #418 hydration errors and keep the copy-page button after navigation #1261 adds clientModules in the same place in docusaurus.config.js. Whichever PR merges second will conflict there. Resolve it by keeping both sets of modules in one list: two clientModules keys would silently drop one set.
  • The navbar's active item and the table of contents still use the bright orange. Fixing that is the site-wide light-mode contrast change, which would reuse this text colour.

I confirm I have read the contributing guidelines.

🤖 Generated with Claude Code

willeastcott and others added 2 commits October 3, 2026 20:07
Every category above the current page turned orange too, and the current
page used the same grey background as a hovered item, so the page you
were on was the hardest entry to spot. The categories above it now keep
the normal text colour in semibold, and only the current page is orange:
an orange-tinted background with orange text that is 4.8:1 against it in
light mode (the old orange on grey was 1.86:1) and 7.3:1 in dark mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sidebar never scrolled on its own, so a page deep in a long section
opened with its entry out of sight: Text to Splats sat 1,334px down an
840px sidebar. A client module now centres the current entry after each
navigation, but only when it isn't already in view, so clicking a
visible entry never moves the list and hash changes are ignored. It
handles the mobile drawer too, which is rendered while closed and so
opens on the current page.

Categories animate open and closed, and auto-collapse can fold a
category above the entry, so the module keeps checking for a second
after each navigation and stops as soon as the reader scrolls, taps or
types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@willeastcott
willeastcott merged commit 3063a71 into main Oct 3, 2026
4 checks passed
@willeastcott
willeastcott deleted the feat/sidebar-current-page branch October 3, 2026 20:22

This branch was successfully deployed

1 active deployment
Preview — 8e5f2528 Deployed Oct 3, 2026 by vercel[bot]
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