Skip to content

feat: flow the TOC rail across visible sections#7

Merged
MentorFilou merged 1 commit into
mainfrom
feat/toc-flow-indicator
Jul 19, 2026
Merged

feat: flow the TOC rail across visible sections#7
MentorFilou merged 1 commit into
mainfrom
feat/toc-flow-indicator

Conversation

@MentorFilou

Copy link
Copy Markdown
Member

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

  • A single rail marker (.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's top/height span from the first to the last visible entry — a continuous bar that slides and stretches across the entry boundary as sections share the screen.
  • Metric: fraction of each section's height currently on screen (a large section only partially fills the rail).
  • Text labels keep a binary yellow highlight (thresholded — lit while a section holds the top reading line or fills ≥40% of the reading area); only the rail is continuous.
  • The old per-link static border-left active 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 build passes (13 pages).
  • Simulated the projection geometry across scroll positions: the marker slides monotonically, spans the entry boundary when two sections co-occupy the viewport, and stays within the list bounds.

🤖 Generated with Claude Code

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>
@MentorFilou MentorFilou self-assigned this Jul 19, 2026
@MentorFilou
MentorFilou merged commit b3a319d into main Jul 19, 2026
1 check passed
@MentorFilou
MentorFilou deleted the feat/toc-flow-indicator branch July 19, 2026 20:55
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