Don't treat IME composition keys as Enter - #82
Open
arakawayasuaki wants to merge 1 commit into
Open
Conversation
Typing Japanese (or any other IME-composed text) sent the prompt half-written: the Enter that commits a kana-kanji conversion reached our keydown handlers as a plain Enter, so the chat input submitted mid-word. The same bug hit every rename and inline-edit field, and in the command palette the arrow keys that pick a conversion candidate moved the result selection instead. Add an isComposingKeyEvent() helper (nativeEvent.isComposing, plus the legacy keyCode 229 that Safari still reports on the commit key) and bail out of the affected handlers while composition is in progress. The Enter/Space handlers on role="button" divs are left alone — they aren't text inputs, so no IME is ever composing over them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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.
Problem
Typing Japanese (or any other IME-composed text) sends the prompt half-written. The Enter that commits a kana-kanji conversion reaches our
onKeyDownhandlers as a plain Enter, so the chat input submits mid-word.The same bug hits every rename and inline-edit field across the app, and in the ⌘K command palette the arrow keys that pick a conversion candidate move the result selection instead.
There was no
isComposingguard anywhere in the frontend.Fix
Add
isComposingKeyEvent()insrc/utils/imeComposition.ts— checksnativeEvent.isComposing, plus the legacykeyCode === 229that Safari still reports on the commit key — and bail out of the affected handlers while composition is in progress.Guarded inputs:
ChatInterface.tsx— prompt input, chat-list rename, title editCommandPalette.tsx— ⌘K palette (Enter and the candidate-selection arrow keys)FileSidebar.tsx— new-file name, file renameShareModal.tsx— add collaborator, create share link, link nameGadgetEditor.tsx,WorkpiecePicker.tsx,GadgetList.tsx,SidebarGadgetRow.tsx— title / rename fieldsSettingsPage.tsx,Connections.tsx,ConnectionConfigModal.tsx,AdminFormatsPanel.tsxLeft alone: the Enter/Space handlers on
role="button"divs inAdminPage.tsx,routes/outputs.tsx,routes/gatekeepers.tsx,routes/providers.tsx. Those activate buttons rather than edit text, so no IME is ever composing over them.Testing
tsc --noEmitandoxlintpass with no new findings. Verified manually against a localpnpm run-localbuild: Japanese conversion now commits without submitting.🤖 Generated with Claude Code