Skip to content

An input method's Escape no longer closes boxes or discards edits - #4162

Merged
backnotprop merged 3 commits into
mainfrom
fix/ime-escape-sweep
Nov 28, 2026
Merged

backnotprop merged 3 commits into
mainfrom
fix/ime-escape-sweep

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

If you type Japanese, Chinese or Korean, you press Escape to cancel the word you are composing. In many Plannotator boxes that same Escape also ran the box's own Escape action. The worst case: an annotation edit in the plan review panel was thrown away. In other boxes a picker, composer, dialog, card panel or search closed. Safari sends this Escape with isComposing false and keyCode 229, so checks that only looked at isComposing missed it. This builds on #3689.

The shared guard: isImeCompositionKey (in packages/ui/utils/commentSubmitKey.ts) and a new holdsImeEscape next to it. holdsImeEscape stops propagation without preventDefault. The Inbox's isComposingKey now calls isImeCompositionKey. The shortcut registry (dispatchShortcutEvent) skips composing keys. Modal <dialog>s (compose, Decide, the shared Inbox Modal) mark an input method's Escape in the capture phase and ignore the native cancel that follows it (useImeCancelHold).

Fixed (Escape):

  • Plan review: annotation panel edit (text and code), @ and / lists, diagram comment, diagram source pane, code file popout edit, option picker, image name, goal setup, attachments popover and path field, Settings dialog and its fields, quick label tip and emoji, comment card and dialog containers, ref hover card, plan diff exit, compact plan stage, the html viewer's iframe bridge.
  • Code review: file comment edit, outdated comment edit, Ask about this code, suggestion modal, file tree search (and its row-focus Escape), PR comments search, Go to file, call flow search, guide rename, live composer, the app's window Escape ladder, expanded comment dialog (through the registry).
  • Inbox: every ComposerField box (reply, New message, compose, floaters, full screen, image, video and HTML comments, PR thread start) and its / @ # lists, reply recipient list, permission deny reason, card panel and its notes and cancel reason, action checklist note, scheduled file path, Decide dialog, shared Modal, tag rename, project rename, add tag, To picker, phone To sheet, folder menu, home folder browser, launch choice menu, review rows, plan files filter, open local picker, annotations chip edit, thread PRs popover, attachment pane comment, bottom sheet, dictation cancel, PR reply box, and the hover cards (agent faces, reactions, initiative peek, sidebar tip, contents panel).

Fixed (Enter that confirms a composition no longer saves or picks): permission deny, scheduled file path, quick label tip, Settings identity and add directory, attachments path, image name, call flow search, file tree search, option picker, guide rename, tag and project rename, add tag, the @ list's tag pick, and the pickers above.

Checked and found fine: Thread reply box and DecisionNoteField (#3689), CommentPopover textarea, chat window, SearchPalette, TitleFilter, ListFilterSections, the Inbox App ladders, useSheetEscape, useListPicks, SheetPage, Base UI menus (AddTagMenu Escape, BulkTags, TagColourMenu), ImageLightbox, HtmlViewer, vim hooks, MarkdownContentsRail, AnnotationToolbar line comment, ReplyRoute and StaleGuard (no text field). The compose dialog keeps main's rule for every key but Escape (only isComposing), so in Safari a Cmd+Enter that the input method takes to accept the word still sends on that same press; only its Escape also counts keyCode 229. The other Mod+Enter sends with their own handlers (PR reply, Ask about this code, live composer) also keep their isComposing-only check. A Mod+Enter that goes through the shortcut registry is now skipped on a keyCode 229 key, like every registry shortcut.

Tests: three table-driven DOM tests (packages/ui/components/imeEscape.composers.test.tsx, packages/review-editor/components/imeEscape.review.test.tsx, packages/inbox/imeEscape.test.tsx). Each one sends both Escape shapes and checks that the box's action did not run and its words are intact, then sends a plain Escape and checks that the action does run. All of them fail with the Safari shape when the guard is turned off. Also covered: the registry's early return (packages/ui/shortcuts.test.ts); the hold on the close that follows an IME Escape, for the shared Inbox dialog and Decide (packages/inbox/imeDialogCancel.test.tsx); and the Enter half (an IME Enter does not save, a plain Enter does) for the quick label tip, Settings identity, Settings add directory, attachment path and scheduled thread file path. One more test in pullAllFiles.test.tsx covers a gap the reviewer found in #3689: picking the scope that is already on starts no focus watcher.

Not verified: a real Android device must still confirm whether Gboard or Samsung Keyboard ever send key 'Enter' with keyCode 229 and isComposing false. If they do, that Enter is now taken as the input method's and does nothing. That matters most for the Done key on tag rename and project rename, where Enter is the only way to save (leaving the field cancels). A second Enter, sent as keyCode 13, saves. Also not verified: a real input method in a real browser. The Safari keyCode-229 path and the native dialog cancel after an input method's Escape were not tried in real Safari or Chrome; they are covered by happy-dom DOM tests only.

A person typing Japanese, Chinese or Korean presses Escape to cancel the word being composed. In many boxes that Escape also ran the box's own Escape: an annotation edit was discarded, pickers, composers, dialogs, panels and searches closed. Safari sends that Escape with isComposing false and keyCode 229, so isComposing-only checks missed it.

One shared check (isImeCompositionKey, holdsImeEscape) now guards the fields, the containers and window listeners above them, and the shortcut registry. Enter that confirms a composition no longer saves or picks in the boxes that lacked the check. Modal dialogs ignore the native cancel that follows an input method's Escape.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 28, 2026
…ts for the registry, dialog holds and the Enter half

In Safari a Cmd+Enter that the input method takes to accept the word arrives with keyCode 229 and isComposing false: main sends on that press, and so does compose again.
# Conflicts:
#	packages/inbox/components/ComposerField.tsx
#	packages/inbox/components/ReplyRecipient.tsx
@backnotprop
backnotprop merged commit 1b2b075 into main Nov 28, 2026
57 checks passed
backnotprop added a commit to bendrucker/plannotator that referenced this pull request Nov 28, 2026
…panel swipes and the HTML viewer's lost highlights

ui 0.67.0 and core 0.25.35 went to npm on 2026-11-28 with package files
that match the v0.29.6 tag (c21f65e), so this pair carries what merged
after v0.29.6, up to v0.29.7.

core 0.25.36 is additive: the linked mark "decisions" and
InboxDecision.machine (backnotprop#4066), DraftFileUploader.previewUrl (backnotprop#4165), and
holdingsOf no longer counting a question Mark read closed (backnotprop#4160). No
exports subpath changes; nothing removed.

ui 0.68.0 is a minor: Escape while an input method composes only ends the
composition, and shortcuts skip such keys; holdsImeEscape is new (backnotprop#3689,
backnotprop#4162). HtmlViewer treats a collapsed live Range as lost (backnotprop#4152). Compact
panels: OverlayScrollArea scrollMemory, SidebarContainer closing and
scrollPositions, ActionMenu compactEdgeSwipe, four new hooks and the panel
rules in theme.css (backnotprop#2861). useLaunchAnnouncement waits for ready (backnotprop#4067).
ui uses nothing new from core; its exact pin follows so a host gets one
core. Publish core first.

README and HANDOFF name the new pair, and HANDOFF adds what the published
0.25.35 / 0.67.0 already held beyond their notes (backnotprop#4114, backnotprop#4151).

bun.lock is bun install's own output: the two package version lines, and
six app workspace version lines (0.29.5 to 0.29.7) the release bumps left
behind.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant