{{ message }}
Repository navigation
Conversation
A new highlight's note editor mounted in the margin at top 0 (the article's top, invisible) and took focus there, before the margin's next-frame layout moved it beside its highlight. When the browser revealed the caret in that window, the page jumped to the top of the article, with the editor focused further down. MarginNotes now tells the editor whether it is placed, and the editor takes the keyboard only then. Amp-Thread-ID: https://ampcode.com/threads/T-01a15bff-c2df-705d-908e-92fabd2f12ff Co-authored-by: Amp <amp@ampcode.com>
…stays put The textarea that stands in for the editor when its chunk cannot load used the native autoFocus, which acts only on mount: in the margin it now mounts before it is placed, so it focuses from an effect instead, as the editor does. The regression test checks each note on its own (the dev server's StrictMode focuses twice), over five notes, and that the page did not scroll. Amp-Thread-ID: https://ampcode.com/threads/T-01a15bff-c2df-705d-908e-92fabd2f12ff Co-authored-by: Amp <amp@ampcode.com>
gnapse
enabled auto-merge (squash)
October 21, 2026 02:22
This branch has not been deployed
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.

Why
Sometimes "Highlight and add a note" scrolled the reader up to the top of the article, and the empty note waited, focused, further down. A new note's editor appears at the top of the article, invisible, until the margin measures it on the next frame. In about half of the tries it took focus while it was still up there, and the browser could scroll to the caret.
What changes
autoFocusacts only on mount, so it would have stayed unfocused.Verification
origin/main's components it failed 3 of 3 runs ("editor at -996");highlights.spec.ts,home-highlights.spec.tsand the notebook specs pass, andpnpm verifypasses.