fix(launcher): ignore IME composition Enter so CJK input does not submit the search - #639
Open
YuriNachos wants to merge 1 commit into
Open
fix(launcher): ignore IME composition Enter so CJK input does not submit the search#639YuriNachos wants to merge 1 commit into
YuriNachos wants to merge 1 commit into
Conversation
…mit the search handleKeyDown had no IME guard, so the Enter that confirms a CJK (Japanese/Chinese/Korean) IME composition candidate was misread as submit and closed/ran the launcher mid-composition. Add a pure, unit-tested isImeComposing predicate (checks the DOM isComposing flag and the legacy keyCode 229) and make it the first check in handleKeyDown (early-return while composing). Fixes SuperCmdLabs#637
3 tasks
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.
Fixes #637
(Also resolves its duplicate #296.)
What changed
Guard the main launcher search input's
handleKeyDownagainst CJK IMEcomposition. Added a small pure predicate
isImeComposing(nativeEvent, keyCode)in
src/renderer/src/utils/keyboard.tsand made it the first check inhandleKeyDown(src/renderer/src/hooks/useLauncherKeyboardControls.ts):while an Input Method Editor composition is in progress (
KeyboardEvent.isComposing === true,or the legacy
keyCode === 229), the handler returns early withoutpreventDefault, so the Enter that confirms a kana-kanji / pinyin candidateis no longer treated as a submit.
Why
While composing Japanese/Chinese/Korean text, the Enter that confirms the IME
candidate arrives as a normal-looking Enter but with
isComposing === true.With no guard, that Enter hit
case 'Enter':→e.preventDefault()→ theselected command ran / the window hid, mid-composition — making the launcher
unusable for CJK input. The sibling handler in
QuickLinkManager.tsx:913already guards with
event.isComposing; the main search input was missing thesame guard. This brings it to parity via an extracted, unit-testable predicate.
Compatibility impact
No impact on Raycast extensions — this is launcher chrome (the main search
input's React keydown handler), not the
@raycast/api/@raycast/utilscompatibility shim. Non-IME users see identical behavior:
isImeComposingisonly true during an active composition (or a legacy 229 keydown), so no
ordinary keystroke is swallowed.
How tested
scripts/test-ime-composition.mjs(mirrorstest-exec-command-timeout-cleanup.mjs, imports the real predicate viaesbuild): 6 assertions, all pass — including
isImeComposing({isComposing:true}, 13) === true,isImeComposing({}, 229) === true,isImeComposing({isComposing:false}, 13) === false.npm test→ 88 tests, 87 pass, 0 fail.npm run build:mainandnpm run build:renderer(vite) → exit 0.npm run check:i18n→ exit 0 (no strings changed).tsc -p tsconfig.renderer.json --noEmitdelta vsmain= 0 (the changeadds no type errors; pre-existing renderer debt is unchanged).