fix: #5152 align TOC navigation with editor viewport - #5153
Draft
foo-hao wants to merge 1 commit into
Draft
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.
Closes #5152
Summary
Root cause
TOC navigation shared the fixed
STANDAR_Yviewport coordinate used for caret-oriented scrolling. Window chrome such as the tab bar moves the editor viewport without changing that coordinate, so headings could either land far down the document or become obscured when the constant was reduced.User impact
Clicking a TOC entry now places the heading near the editor's visible top edge with consistent clearance across layouts, including windows with multiple tabs.
Type of change
Test plan
corepack pnpm run buildcorepack pnpm run test:unit— 50 files, 736 tests passedcorepack pnpm -C packages/desktop exec playwright test test/e2e/toc-scroll.spec.ts test/e2e/anchor-link-scroll.spec.ts— 6 tests passedcorepack pnpm run typecheckcorepack pnpm run lintDemonstration
With two documents open, clicking
Heading Number 18keeps the full heading visible below the tab bar:Notes for reviewers
The TOC uses a dedicated container-relative calculation. Search highlights and non-heading anchors continue using their existing caret-oriented reveal position.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.