Skip to content

fix: rest outline-chosen headings at the document's top clearance - #665

Merged
Azganoth merged 1 commit into
mainfrom
bug/outline-heading-clearance
Oct 10, 2026
Merged

Azganoth merged 1 commit into
mainfrom
bug/outline-heading-clearance

Conversation

@Azganoth

Copy link
Copy Markdown
Owner

Summary

Choosing a heading from the outline scrolled it to a fixed 16px below the top of the view, closer than the editor's own top padding (32px narrow, 40px wide), and applied the same offset to the opening heading, so returning to it left the view scrolled past the document's start.

  • A chosen heading now comes to rest where the document's first line rests before any scrolling: the scroll position becomes the heading's offset from the top of the editor content. The clearance therefore follows the editor's top padding at every width and also clears the search panel while it is open, without a separate constant. A heading in the last screen still stops wherever scrolling ends.
  • A heading that opens the document, first at every level of nesting so a heading leading a quote or list at the top counts, returns the view to scrollTop 0. A first heading that follows introductory content still navigates to its own position.

Related Issue

Closes #659

Verification

  • pnpm exec vitest run src/features/editor/utils/headingOutline.test.ts: over a simulated scrolling viewport, opening, middle, nested, and final headings come to rest at the document's starting line, an opening heading returns to 0 even inside a quote, and a first heading after introductory content keeps its own position, with the caret at the heading's start and the Markdown unchanged. These cases fail against the fixed offset.
  • pnpm check:frontend passed.

Not verified: the updated heading-outline desktop scenario, which checks quoted and list-nested headings against the document's starting line at 640px and 1200px window widths, the opening heading returning to 0, and the final heading staying visible, was not run locally and is left to CI. The rendered result was not inspected in the app.

@Azganoth Azganoth added the Bug Something isn't working label Oct 10, 2026
@Azganoth Azganoth self-assigned this Oct 10, 2026
@Azganoth
Azganoth merged commit 6884856 into main Oct 10, 2026
3 checks passed
@Azganoth
Azganoth deleted the bug/outline-heading-clearance branch October 10, 2026 14:38
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Leafdown Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Outline navigation leaves insufficient heading clearance

1 participant