Skip to content

fix: a click away with the command line open stands, and the Status Line of the Field left hides (#100) - #103

Merged
Kyu-seok merged 1 commit into
mainfrom
issue-100
Nov 22, 2026
Merged

Kyu-seok merged 1 commit into
mainfrom
issue-100

Conversation

@Kyu-seok

Copy link
Copy Markdown
Owner

Summary

A click outside the open command line was undone: the Field took focus back from what the person clicked, on every Field kind, and the Status Line kept reading --NORMAL--: after the prompt was gone. Both came from the adapter's own close on blur, which re-focuses the Field and runs none of the engine's cancel.

 the command line's input blurs (a click elsewhere in the page)
-  adapter openDialog's blur listener, a task later
-    close()
-      hideDialog
-      cm.focus() → Session.focusForEngine()       # takes focus back from the click
-    # no clearInputState: vim.status keeps ":" → the bar reads --NORMAL--:
+  Mirror.cancelOnBlur (closeOnBlur: false passed to openDialog), a task later
+    prompt already closed, or Session ended → nothing
+    input still its tree's active element     → nothing   # the adapter's check, in the shadow root
+    Escape keydown on the input               # the engine's own cancel: onPromptKeyDown
+      clearInputState, close()
+      cm.focus()                              # dropped: focus stays where the click put it
+    Session.onCommandLineLeft
+      Field has no focus → status.hide()

Esc, Enter and an Enter that ends in a notice close in the same call as before, with the Field focused and the Cursor where it was (#88, #90, #97).

docs/engine-seams.md: "Dialog lifetime" gains the blur close; "Focus" and "Selection and focus" are corrected where they described the engine's re-focus after a click.

Closes #100

Evidence

  • Before: npm run red-on-main -- tests/e2e/command-line.spec.ts tests/e2e/site-shapes.spec.ts tests/e2e/shadow-contenteditable.spec.ts tests/unit/session.test.ts exits 0: the 30 new e2e tests (every one named #100) and both new unit tests fail on main's source.

    w, :, type "zz", click another input
      expect bar hidden            ✘ on main: reads --NORMAL--:
      expect focus on that input   ✘ on main: back on the textarea
      press x → Field text unchanged
    

    After: npm run check passes: 581 unit tests, 300 e2e, 0 flaky. npm run test:e2e:editors: 295 passed, 0 flaky.

  • Covered through the built extension: a textarea, a Single-line Field, a contenteditable, a contenteditable in a shadow root and the Notion shape (another block, the header's controls, text outside the root); : and /, and ? on the textarea; Normal mode, and on the textarea Visual mode and Insert and Replace mode through Ctrl-o; coming back by a click, by focus, and by the caret moving into the block.

Merge Danger

Door: two-way

Two source files; reverting the commit restores the adapter's close.

Blast Radius: command-line

  • Text typed in a prompt the person clicks away from now goes into ex/search history, as on Esc. It is not run.
  • A blur that leaves the prompt's input the active element of its own tree no longer closes the prompt (before: it closed and the Field took focus). Which real blurs do that (the window losing focus, a frame left for the page around it) is not probed; only a synthetic blur is unit-tested.
  • Not covered: a Field inside a frame, left by a click in the page around it.
  • No pin was added to tests/unit/chromium-facts.test.ts: the fix does not tell the person's click from a selection the page writes, the brief's candidate. That distinction is still Notion: the command line opened right after a cursor move loses focus back to the page #98's, which has a note on what changed under it.
  • The code review ran on the first version; the fixes for its findings are in the commit and have not been reviewed again.

🤖 Generated with Claude Code

…ine of the Field left hides (#100)

The adapter closed the prompt a task after its input blurred through
openDialog's bare close: it called cm.focus(), the Session's focus of the
Field, which took focus back from what the person clicked, and it ran none
of the engine's cancel, so vim.status kept the prompt's key and the bar read
--NORMAL--: until the Session next handled a key.

The mirror now wraps cm.openDialog (Mirror.cancelOnBlur): the adapter's
close on blur is off, and the blur is answered a task later with an Escape
keydown on the prompt's input, the engine's own cancel path, its re-focus
dropped. The Session then hides the Status Line unless focus went to its
Field. A blur that leaves the input the active element of its own tree
closes nothing, the adapter's check made where it can hold.

Tests: 30 e2e (textarea, Single-line, contenteditable, shadow root, the
Notion shape; : / ?; Normal, Visual, Insert and Replace through Ctrl-o) and
two unit tests, all red on main's source (npm run red-on-main). The #97
click-away test is now one of them, with the bar asserted.

docs/engine-seams.md: "Dialog lifetime" gains the blur close; "Selection and
focus" and "Focus" are corrected where they described the engine's re-focus
after a click, which no longer happens.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Kyu-seok
Kyu-seok merged commit 34f41c1 into main Nov 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant