Skip to content

feat: restore scroll position to last viewed block on note switch and app startup#26

Merged
j4rviscmd merged 2 commits intomainfrom
feat/scroll-restore
Mar 23, 2026
Merged

feat: restore scroll position to last viewed block on note switch and app startup#26
j4rviscmd merged 2 commits intomainfrom
feat/scroll-restore

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Persist the currently visible BlockNote block ID per note in localStorage
  • Restore scroll position synchronously inside the onContentLoaded microtask so the browser never paints the intermediate top-of-document state
  • Save position on debounced scroll (500ms), note switch (imperative, before DOM update), and visibilitychange

Test plan

  • Open a note, scroll down, switch to another note, switch back → position restored
  • Open a note, scroll down, close and reopen the app → position restored
  • Delete the block that was saved as scroll anchor → falls back to top
  • Create a new note (no saved position) → starts at top as expected

🤖 Generated with Claude Code

… app startup

Persists the currently visible BlockNote block ID per note in
localStorage and restores the scroll position synchronously inside
the onContentLoaded microtask so the browser never paints the
intermediate top-of-document state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the enhancement New feature or request label Mar 23, 2026
@j4rviscmd j4rviscmd merged commit 8f2effa into main Mar 23, 2026
@j4rviscmd j4rviscmd deleted the feat/scroll-restore branch March 23, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant