fix: Enter submits during Japanese/CJK IME composition#99
Merged
Conversation
Track IME composition state via compositionstart/compositionend on every Enter-to-submit input and block submission while composing. On macOS built-in Japanese IME, the Enter keydown that confirms an IME candidate can fire after compositionend with e.isComposing === false and e.keyCode === 13, so checking e.isComposing alone is insufficient — Enter confirming the candidate was sending the message. Chat/message inputs (homepage, conversation, task) and other Enter-triggered fields (search, task title, workspace folder, volume mount) use a composing flag set on compositionstart and cleared via setTimeout(..., 0) on compositionend, so the confirm-Enter keydown that may follow still sees the flag set. VariablePopup only receives a KeyboardEvent from its parent, so it gets the lighter keyCode !== 229 check.
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
compositionendwithe.isComposing === falseande.keyCode === 13, so guarding only one.isComposingorkeyCode === 229is insufficient.oncompositionstart/oncompositionend, with the flag cleared viasetTimeout(..., 0)so the confirming Enter keydown that may follow still sees composition as active.Scope
VariablePopuponly receives aKeyboardEventfrom its parent, so it gets the lighter!e.isComposing && keyCode !== 229check rather than local state.Test plan
svelte-checkclean (0 errors)