Skip to content

fix: reset scroll position when opening another document - #653

Merged
Azganoth merged 1 commit into
mainfrom
bug/document-switch-scroll
Oct 6, 2026
Merged

Azganoth merged 1 commit into
mainfrom
bug/document-switch-scroll

Conversation

@Azganoth

@Azganoth Azganoth commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

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=2 passed, covering viewport replacement, same-document caret and focus restoration, and wiki-link navigation.

  • Desktop E2E document-lifecycle and folder-search scenarios passed on Windows against a fresh pnpm build:e2e:desktop binary. 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, and pnpm build.

  • pnpm exec vitest run --coverage --maxWorkers=2 passed 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.

@Azganoth Azganoth added the Bug Something isn't working label Oct 6, 2026
@Azganoth Azganoth self-assigned this Oct 6, 2026
@Azganoth
Azganoth merged commit d7fd33c into main Oct 6, 2026
5 of 6 checks passed
@Azganoth
Azganoth deleted the bug/document-switch-scroll branch October 6, 2026 04:38
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.

Opening another document retains the previous document scroll position

1 participant