Repository navigation
Merged
Conversation
…sor when the command line closes (#97) The engine's re-focus focused the root alone, which left the caret at the root's start, outside every block: the block had no focus by its own definition, the root's focus event resolved to the root, and the next key was typed into the page as text. ContentEditableField.focus on a nested Field now puts its last selection back inside it while the root is blurred. That focuses the root, and the root's focusin fires during the call with the caret already in the Field, so the event resolves to the Field and its Session's focus handler runs inside Session.focusForEngine's mark. A root that already has focus is left alone: the command line also closes when its input blurs, and a caret the person clicked into another block meanwhile stands. Fields that are their own focus target take the same path as before. Coverage (CODING_STANDARDS rule 5), on the fixture's Notion shape: Normal mode for Esc in : / ? and Enter on :noh and on an unknown ex command, Visual mode, Insert and Replace through Ctrl-o, and a click into another block with the command line open. A nested Field inside an open shadow root is not covered. The eight closing tests are red on main; the click-away test is green there and red without the blurred-root guard. Co-Authored-By: Claude Fable 5.2 <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.
Summary
On a Field nested in an editable root (a Notion block), the command line closing left the caret at the root's start, outside every block: the block had no focus by its own definition, the root's focus event resolved to the root, and the next key was typed into the page's header as text.
A root that already has focus is left alone. The command line also closes a task after its input blurs, and a caret the person clicked into another block meanwhile stands.
Fields that are their own focus target (a textarea, a Single-line Field, a plain or shadow-root contenteditable host, the four rich editors) take the same path as before.
docs/engine-seams.md"Focus" and "Selection and focus" say what is true now; the Chromium fact the fix builds on is pinned intests/unit/chromium-facts.test.ts, "Selection and focus".Closes #97
Evidence
npm run red-on-main -- tests/e2e/site-shapes.spec.ts→ "every file is red on main": the eight closing tests fail there.After:
npm run checkpasses: 579 unit tests, 271 e2e, 0 flaky.npm run test:e2e:editors: 295 passed, 0 flaky.quill.spec.ts:96: abeforeEachtimeout at load average 12.6 that passed on retry. Quill's host is its own focus target, a path this PR does not change.main, filed as A click away with the command line open is undone (the Field takes focus back), and the prompt's character stays in the Status Line #100: after a click into another block with the command line open, the old block's Status Line stays showing.Merge Danger
Door: two-way
One method,
ContentEditableField.focus(); reverting the commit restores the old behaviour.Blast Radius: nested-Fields
Sessions.reconcilealso callsfocus(): a nested Field the page blurred in answer to a remembered Activation key now gets its caret back and keeps its Session, where before it was disposed. That path is untested.🤖 Generated with Claude Code