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
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Leafdown Oct 6, 2026
Azganoth added a commit that referenced this pull request Oct 13, 2026
## Summary

Prepare v0.1.0-alpha.3 and promote the accumulated Unreleased changelog
so the packaged app can display its own release notes. Align application
and Cargo metadata with WiX's numeric `0.1.0.3` version, and point the
desktop release-note scenarios' current-release highlight at alpha 3's
first entry.

The changelog entry for #653 moves from alpha 2 to alpha 3: it merged
after the alpha 2 tag but had been filed under that release's section.
It now speaks of a newly opened document rather than a replacement one,
since opening a document adds a tab instead of replacing the active
document.

## Related Issue

Refs #698.

## Verification

- `pnpm check` passed formatting, type, lint, production frontend build,
frontend coverage, and backend checks.

[PR CI](https://github.com/Azganoth/leafdown/actions/runs/38323432685)
passed frontend checks, backend checks, and the complete desktop E2E
suite, including the release-note scenarios against alpha 3's notes.

Not verified: installer builds, left to the tagged Release workflow;
NSIS and MSI install, upgrade from alpha 2, uninstall, and Open with
lifecycle checks, deferred for this prerelease by maintainer decision in
#698.

## Notes

The alpha 3 section is dated 2026-10-12 and should match the day the tag
is pushed.
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