-
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
[Mobile] - Add new KeyboardEvent.code attribute to RichText onKeyPress event #43521
Conversation
@@ -0,0 +1,9 @@ | |||
export const KEYCODES_MOBILE = { | |||
13: 'Enter', |
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.
I didn't use the values from @wordpress/keycodes
just in case those get deprecated with this keyCode
being deprecated effort.
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
40: 'ArrowDown', | ||
37: 'ArrowLeft', | ||
39: 'ArrowRight', | ||
8: 'Backspace', |
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.
I'd also suggest adding Space
and Delete
as those are used in #43442.
Feel free to borrow from this keymap if that helps: https://github.com/testing-library/user-event/blob/main/src/keyboard/keyMap.ts
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.
Great idea! I'll add those, thank you @tyxla 🙇
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.
Let me know if you need reviews FWIW. I owe you a few already 😉
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.
Thank you for addressing this issue! The outlined tests succeeded for me on an iPhone SE (iOS 16) and Samsung Galaxy S20 (Android 12). 🎉
I left a couple of comments for consideration. Let me know what you think. 🙇🏻
…anges on the web editor using KeyboardEvent.code since codeKey is now deprecated.
8888efe
to
15db467
Compare
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.
🚀 Nicely done! I retested the changes. Thank you.
Related PRs:
Gutenberg Mobile
-> [Mobile] - Add new KeyboardEvent.code attribute to RichText onKeyPress event wordpress-mobile/gutenberg-mobile#5114What?
This PR adds the
code
attribute to the key events sent from theAztecView
component.Why?
Since keyCode is deprecated and there's an ongoing effort to replace it with code values, we are adding this on the native side to match with the web editor.
It also fixes a regression with the slash inserter (Autocomplete).
How?
By adding the
code
attribute for the key press events in theAztecView
component. It matches the native key values with the Web API values.Testing Instructions
/
in a Paragraph block and type the name of a blockScreenshots or screencast