feat: flow the TOC rail across visible sections#7
Merged
Conversation
Replace the single-active scrollspy with a continuous rail marker whose top and height track the projection of the visible document window onto the on-page TOC entries. The yellow highlight now spans (and slides across) exactly the sections currently on screen, sized by how much of each section is visible, instead of snapping to one heading. Link labels keep a binary highlight (thresholded) while only the rail flows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes the right-rail "On this page" indicator dynamic. Instead of a single yellow heading that snaps as you scroll, the rail highlight now flows to cover the sections currently on screen.
How
.toc-flow) is positioned along the TOC's left border. Each frame (rAF-throttled scroll/resize), we compute, per section, the portion visible in the viewport and project that slice onto the section's TOC entry. The marker'stop/heightspan from the first to the last visible entry — a continuous bar that slides and stretches across the entry boundary as sections share the screen.border-leftactive state is removed in favour of the flowing marker.Pure progressive enhancement, zero new dependencies. Falls back to no marker if JS is off.
Verification
pnpm buildpasses (13 pages).🤖 Generated with Claude Code