Repository navigation
fix: reset scroll position when opening another document - #653
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
Opening another document retained the previous document's scroll offset. Reset the enclosing viewport when document identity changes, while same-document reloads keep their restoration path. Focus heading navigation and focused caret restoration before requesting ProseMirror scrolling so their targets are visible.
Related Issue
Closes #646
Verification
pnpm exec vitest run src/components/screens/document-screen.test.tsx src/features/editor/tests/wikiLink.test.ts --maxWorkers=2passed, covering viewport replacement, same-document caret and focus restoration, and wiki-link navigation.Desktop E2E
document-lifecycleandfolder-searchscenarios passed on Windows against a freshpnpm build:e2e:desktopbinary. They verify rendered viewport offsets and target visibility through navigator and Open recent replacements, cross-document heading navigation, external reloads, and folder-search navigation. The runner used an isolated WebDriver port because the default port was occupied.Frontend formatting, lint, typecheck, and production build passed through
pnpm check:oxfmt,pnpm lint:frontend, andpnpm build.pnpm exec vitest run --coverage --maxWorkers=2passed with the existing coverage thresholds.CI passed frontend checks, backend checks, the Rust dependency audit, and the full desktop E2E suite for commit
5ee2d39ef88df2d147900607eb7b630890ff4b92.Not verified: manual interaction with the native Open file picker.