[WP6.1.1] FormTokenField: Revert to event.keyCode to fix IME composition issue#45703
Conversation
|
|
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 ); |
mirka
left a comment
There was a problem hiding this comment.
Code is working as expected, tested on Mac Chrome/Firefox/Safari 👍
What?
This PR is backported to WP6.1.1 and reverts
event.codetoevent.keyCode, one of the changes made toFormTokenFieldin #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.