-
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
[WP6.1.1] FormTokenField: Revert to event.keyCode
to fix IME composition issue
#45703
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
event.keyCode
to fix IME compos…event.keyCode
to fix IME composition issue
I think unit tests are failing because @tyxla, any suggestions on how we can fix this? |
|
@tyxla |
Pushed 3146412 - let me know if it works well. Alternatively, if that doesn't work, we can just fall back to using |
@tyxla
Therefore, I believe that the test may need to be rewritten using fireEvent. |
@tyxla, we decided to revert to the deprecated See the discussion at #45607 (comment) for more details.
I think we might need this change to get tests working with |
Cool, that makes sense. I'm happy to help with that migration FWIW. |
We need to revert the refactoring from Should we revert this entire PR? |
It would also revert the TS migration done there FWIW. cc @ciampo Reverting the full PR might make sense in the short term, we can do a take 2 afterwards. |
It should be a "hotfix" for WP 6.1.1, so let's do what you think would be the simplest solution. |
I am trying to refactor the following code to make it pass the tests. fireEvent.keyDown( input, {
keyCode: BACKSPACE,
} ); However, it fails for some tests, so it may be badly written |
72019c7
to
450b9a4
Compare
I adjusted the tests to pass while keeping the await user.type( input, 'dragon fruit[Enter]' );
// to...
function triggerEnter( element: Element ) {
fireEvent.keyDown( element, {
keyCode: ENTER,
} );
}
await user.type( input, 'dragon fruit' );
triggerEnter( input ); |
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.
Code is working as expected, tested on Mac Chrome/Firefox/Safari 👍
What?
This PR is backported to WP6.1.1 and reverts
event.code
toevent.keyCode
, one of the changes made toFormTokenField
in #43442.This separate PR # 45607 will be applied to Gutenberg's latest trunk.
Why?
The background behind the creation of this PR can be found after the comments here.