Repository navigation
Merged
Conversation
…ck into the Field (#98) Notion takes the Cursor VimText announces into its model and writes it back to the DOM some milliseconds later. After a move and `:` typed back to back the command line's input has focus by then, and a selection set inside a blurred editable root focuses the root: the prompt was cancelled (since #100; before, left showing) and the keys typed next were Normal keys. The page's write and the person's click both arrive as a blur of the input. Chromium names the device behind a click's or Tab's focus change in FocusEvent.sourceCapabilities and leaves it null for a script's. A blur that names no device and leaves the Field focused now gives the input focus back, in a microtask from the blur (Mirror.cancelOnBlur, byScript), three times at most for one prompt. The Session no longer reads the Field on a focus that arrives while the command line is open: the root's focusin fires mid-write, where a Visual selection reads as a caret; a click back into the Field is read when the prompt closes. The Notion shape of the site-shapes fixture writes its model's selection back as Notion does. Tests: seven Chromium pins ("A page that writes its selection back"), seven e2e tests and one unit test named #98, all red on main's source (npm run red-on-main -- -g '#98'); a click back with the command line open on a Single-line Field and inside a shadow root. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…a write is in flight A contenteditable write still pending when the command line opens (an edit and `:` typed back to back) selects its range in the blurred host, a script's blur like the page's. The prompt took focus back after each of the write's three selections, and its commands then ran in the prompt's input: `wx:` lost the deletion. The prompt now leaves focus alone while a write is pending; the write lands and the prompt is cancelled, as before #98. Tests: `x and : typed back to back` on a contenteditable (the deletion was lost in five of five runs before this commit), and the page's write landing while a search is being typed. docs/engine-seams.md says where the script focus is pinned rather than "on every Field kind". 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 Notion, a cursor move followed at once by
:opened the command line, and a few milliseconds later Notion wrote the Cursor VimText had announced back to the DOM. A selection set inside a blurred editable root focuses it, so focus left the prompt and the keys typed next were the block's Normal keys.The page's write and the person's click both arrive as a blur of the prompt's input. Chromium tells them apart on the event itself:
FocusEvent.sourceCapabilitiesnames the device behind a click's or Tab's focus change and is null for a script's.The Notion shape of the site-shapes fixture now writes its model's selection back after an untrusted
selectionchange, as Notion does (18 ms; the tests widen it so the write lands after the prompt opens on a loaded machine).docs/engine-seams.mdgains "A page that writes its selection back".Closes #98
Evidence
Before:
npm run red-on-main -- -g '#98' tests/e2e/site-shapes.spec.ts tests/unit/session.test.ts→ "every matching test is red on main": seven e2e tests and one unit test.After:
npm run checkpasses: 592 unit tests, 330 e2e, 0 flaky.npm run test:e2e:editors: 295 passed, 0 flaky (again on the pushed commit).Seven Chromium pins in
tests/unit/chromium-facts.test.ts, "A page that writes its selection back": the blur of a click (onto an input, onto text, into an editable root) and of Tab names a device; a script'sfocus()and a script's selection write name none, a script inside the task of the person's key included; the root'sfocusinfires betweencollapseandextend; a microtask from the blur runs after the script.Covered on the Notion shape:
wandbbefore:;/and?; closed by Enter, by Esc and by an Enter that ends in a notice; Visual mode. A click back with the command line open, which the Session now reads at the close, is covered on a textarea, a Single-line Field, a contenteditable, inside a shadow root and on the Notion shape.Merge Danger
Door: two-way
Blast Radius: command-line
focus()) now keeps the prompt open, on every Field kind. Esc still closes it.sourceCapabilitiesis Chromium-only. Where it is missing every blur counts as the person's, which is 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's behaviour.mainby design and carry no#98tag: the retake cap's unit test, and the "typed with no pause" e2e, which passes there whenever the keys beat the page's write.sourceCapabilitiesand the other fixes for its findings have not been reviewed again.🤖 Generated with Claude Code