Fix: don't submit comment on IME composition Enter key - #30
Open
ulysses0604 wants to merge 1 commit into
Open
Conversation
Every Enter-key keydown handler that submits a comment (the comment composer, inline comment editing, the send-batch shortcut, and the artifact SDK's link-input) treated a bare Enter as "submit" without checking whether an IME composition was in progress. Japanese/CJK users pressing Enter to confirm kanji conversion had their in-progress comment submitted prematurely instead. Add an isImeCommitEnter(event) guard (event.isComposing, with the legacy keyCode === 229 fallback) before each of these handlers acts, so a composition-confirming Enter no longer triggers preventDefault() or the submit action.
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
Every Enter-key handler that submits a comment treated a bare Enter as "submit," with no check for whether an IME composition was in progress. Japanese/CJK users pressing Enter to confirm kanji conversion had their in-progress comment submitted prematurely instead of just confirming the conversion.
This affected:
#composeTextinchrome-client.js)editCommentinchrome-client.js)chrome-client.js)sdk.js)Fix
Added a small
isImeCommitEnter(event)guard (event.isComposing || event.keyCode === 229) before each handler's submit action, so a composition-confirming Enter no longer triggerspreventDefault()or the submit action.Testing
npm test— all existing tests pass, no regressions