Skip to content

feat(outline): highlight active heading on scroll#33

Merged
adibhanna merged 1 commit into
mainfrom
feature/outline-active-heading
May 5, 2026
Merged

feat(outline): highlight active heading on scroll#33
adibhanna merged 1 commit into
mainfrom
feature/outline-active-heading

Conversation

@adibhanna

Copy link
Copy Markdown
Contributor

Summary

  • Tracks the topmost-visible heading from the editor's scroll surface (or the preview's, in preview mode) and highlights the matching row in the outline panel so users can orient at a glance while scrolling long notes.
  • Probe sits ~25% down the viewport (capped at 140px) so a heading lights up as soon as it enters the upper portion of the visible area, not only after it scrolls past the very top edge.
  • Active row uses an accent tint (bg-accent/12, text-accent, semi-bold) and auto-scrolls into view with block: 'nearest' so it doesn't fight the user when already visible.

Test plan

  • Open a long note with multiple headings, toggle the outline panel, and scroll the editor — the active heading should update as each new section enters the upper portion of the viewport.
  • Scroll back to the top above all headings — no row should be highlighted.
  • Switch the pane to Preview mode and scroll there — the active heading still updates correctly.
  • In Split mode, scroll the editor side — outline tracks the editor.
  • Type new headings inline; line numbers shift but the active row stays correct.
  • Filter the outline so the active heading is filtered out — no errors, other rows render normally.
  • Note with zero headings — no highlight, no errors.

Track the topmost-visible heading from the editor's scroll surface (or
the preview's, in preview mode) and tint the matching row in the
outline panel so users can see at a glance which section they're in.
The probe sits ~25% down the viewport so a heading lights up as soon
as it enters the upper portion of the visible area.
@adibhanna
adibhanna merged commit 2508a2f into main May 5, 2026
5 checks passed
@adibhanna
adibhanna deleted the feature/outline-active-heading branch May 5, 2026 15:32
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