Repository navigation
fix(prompt-input): leave a composition-ending Escape to the IME - #164
Open
pratikbuilds wants to merge 3 commits into
Open
pratikbuilds wants to merge 3 commits into
pratikbuilds wants to merge 3 commits into
Conversation
While the suggestion list is open, the window-capture claimEscape listener marks Escape handled so an enclosing Radix layer does not dismiss. It skipped only `isComposing`, but Safari sends the key that ends a composition with `isComposing` already false and keyCode 229. Skip that too, as onKeyDown and the toolbar's useClaimEscape already do. Follows up the review of corbitsdev#150 (corbitsdev#142 finding 13).
Contributor
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. |
A keyCode 229 Escape was left unclaimed so the IME could take it. Radix still saw it on document capture, preventDefaulted it, and dismissed the dialog. Stop that event at the window instead, and keep preventDefault on a normal Escape so the list closes and the dialog stays.
An Escape with isComposing still reached document capture, so Radix preventDefaulted it and dismissed the dialog. Stop that key the same way as keyCode 229, and keep claiming a normal Escape.
TheGreatAxios
approved these changes
Nov 4, 2026
TheGreatAxios
left a comment
Contributor
There was a problem hiding this comment.
Approving. A composing Escape and a keyCode 229 Escape stop on the window capture path without preventDefault, so the IME keeps the key and a dialog does not dismiss. A normal Escape is still claimed and closes the suggestion list.
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
While the suggestion list is open,
usePromptInputclaims Escape from a window-capture listener so an enclosing Radix dialog or popover doesn't dismiss. Safari sends the key that ends a composition withisComposingalready false andkeyCode229. Chrome and Firefox send Escape withisComposingstill true.Leaving either key unclaimed is not enough inside a dialog. Radix
DismissableLayerlistens on document capture and, whenkey === "Escape"anddefaultPrevented === false, callspreventDefault()and dismisses.claimEscapenowstopPropagation()sisComposingandkeyCode === 229and does notpreventDefault(), so the IME keeps the default action and the event never reaches Radix. A normal Escape is stillpreventDefault()ed, so the dialog stays and the suggestion list closes.Verification
src/hooks/use-prompt-input.test.ts: with the mention list open, Escape{ isComposing: true, keyCode: 27 }and Escape{ keyCode: 229, isComposing: false }are not prevented, a document-capture listener does not see them, and the list stays open. A following normal Escape closes the list and is claimed. Once the list is closed, a later Escape is not claimed.bun run checkpasses (885 unit tests).Closes #142