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
Add W3C KeyboardEvent.key values support. #10
Conversation
…e() call on non-strings
Sorry about the flow mess. Just setup a Linux VM to properly test the project. |
Awesome work Leo, this is epic stuff 🙌 |
/** | ||
* Helpers | ||
*/ | ||
function valFromCode(keyCode: ?number): ?string { |
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 would name this keyValueFromCode
and move it to lib/utils.js
…semantics and use proper Flow types
Glad you enjoyed it and you were able to learn something from this. |
Merged this in, will try to release a new version in the next couple days, thank you for your contribution! |
As discussed at #7
KeyboardEvent.keyCode
is deprecated, also MDN recommends to avoid it for new projects in favor ofKeyboardEvent.key
.This PR is a result of following this recommendations without dropping the support for
keyCode
since not every browser has implemented the new standard yet.The usage of
keyValue
instead ofkeyId
as discussed at #7 is to match an ubiquitous terminology with current standards.Now, despite letter case, the arrow keys values are the only difference I notice from
keycodes
naming to actualkey
values sokeyNameVals
might seams dummy, but it allows to map any another differences.Hope it helps!
Cheers