Repository navigation
fix: rest outline-chosen headings at the document's top clearance - #665
Merged
Merged
Conversation
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.
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.
scrollTop0. 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:frontendpassed.Not verified: the updated
heading-outlinedesktop 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.