ComboboxControl: Fix unexpected behaviour in IME Composition#46827
Merged
Conversation
|
Size Change: +30 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
7 tasks
alexstine
approved these changes
Dec 31, 2022
mirka
approved these changes
Jan 3, 2023
mirka
left a comment
Member
There was a problem hiding this comment.
Working as expected in Mac Chrome/Firefox/Safari. Thanks!
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.
Part of #45605
What?
This PR fixes the following two problems with IME compositions in the
ComboboxControlcomponent:enterkey is pressedescapekey is pressed58ae586d7fc0c20ff273fd19544844e8.mp4
Why?
This component handles keydown events, but the IME mode has the following roles during input:
Enter: to confirm your input.Escapeto hide input candidates or cancel what you are typing.During these operations, key events should be ignored because character input is not finalized.
How?
Added determination of whether or not the compose is in progress, as was done with #45607 and #45626.
Testing Instructions for Keyboard
In the storybook, confirm the following actions.
example of data for the options prop
enterkey, the characters should be comitted. The second time you press theenterkey, the selected suggestion should be entered.escapekey, the IME candidate should disappear. The second time you press theescapekey, the characters you entered should disappear.16cc933a26a8c1b0cc5410369be962d5.mp4
In addition, I have confirmed that the following browsers work as expected in Windows 11:
✅ Google Chrome Version 108.0.5359.125
✅ Microsoft Edge Version 108.0.1462.54
✅ FireFox Version 107.0.1
Next Step
This component still has the following two issues that this PR does not resolve:
arrow-up/arrow-downkeys.I believe this problem is due to TokenInput triggering events even while composing:
gutenberg/packages/components/src/form-token-field/token-input.tsx
Lines 38 to 44 in 0b8030d
Since this component is used by both
ComboboxControlandFormTokenField, I would like to address this issue as a follow-up.