Repository navigation
fix: keep the scroll position when saving a note - #195
Merged
Merged
Conversation
The "Desktop Chrome" device reports a Windows platform, and the app picks the save shortcut's modifier from that platform, so Meta+S never saved on macOS. The focus-after-save test passed without saving; it now also checks that the note was saved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saving scrolled the editor to the top in two cases: - The first save of a new note, and a save that renames a note: the note's scroll position was reset on every slug change. It is now reset only when the slug changes along with the editor instance, i.e. when another note is opened. - Every save in a window too narrow for the note list, where the document scrolls: the save navigates to the note's URL, and the Navigation API scrolls to the top after an intercepted replace. The save now asks the router for manual scrolling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Saving a note (Cmd-S or the save button) scrolled the editor to the top. There were two causes:
Note.tsxreset the note's scroll position on every slug change. It now resets only when the slug changes along with the editor instance, which is what opening another note does (load, new, duplicate, import).keepScrollPositionin the navigation'sinfo, and the router usesscroll: "manual"for it. Other navigations, including back/forward scroll restoration, are unchanged.The first commit fixes a test problem found along the way:
KEY_COMBINATIONS.SAVEsentMeta+Son macOS, but the "Desktop Chrome" device reports a Windows platform, so the app ignored it. "editor should keep focus after saving with key combination" passed without saving. It now checks that the note was saved.Tests
npm run lint,npm run build,npm run testand all 65 integration tests pass.🤖 Generated with Claude Code