-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComboboxControl: Fix unexpected behaviour in IME Composition #46827
Merged
Conversation
This file contains 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
Size Change: +30 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
t-hamano
changed the title
ComboboxControl: Fix unexpected behaviour in IME Composition
[WIP]ComboboxControl: Fix unexpected behaviour in IME Composition
Dec 30, 2022
t-hamano
changed the title
[WIP]ComboboxControl: Fix unexpected behaviour in IME Composition
ComboboxControl: Fix unexpected behaviour in IME Composition
Dec 30, 2022
7 tasks
alexstine
approved these changes
Dec 31, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@t-hamano Looks good.
mirka
approved these changes
Jan 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as expected in Mac Chrome/Firefox/Safari. Thanks!
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
ComboboxControl
component:enter
key is pressedescape
key is pressed58ae586d7fc0c20ff273fd19544844e8.mp4
Why?
This component handles keydown events, but the IME mode has the following roles during input:
Enter
: to confirm your input.Escape
to 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
enter
key, the characters should be comitted. The second time you press theenter
key, the selected suggestion should be entered.escape
key, the IME candidate should disappear. The second time you press theescape
key, 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-down
keys.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
ComboboxControl
andFormTokenField
, I would like to address this issue as a follow-up.