Numpad keys
GoGoris opened this issue · comments
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
Missing Numpad* keys (NumpadEnter, NumpadMultiply, NumpadDecimal, NumpadEqual...)
Hi @GoGoris, thanks for opening an issue!
This enum is automatically generated by scraping this page: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values, so anything that doesn't appear on this page won't show up in the enum.
However, check out this section: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Numeric_keypad_keys. Will these values work for your purpose?
Hi @nfriend,
Because of numerous reasons, people prefer to use the numpad for all numeric inputs in Belgium. For them there is no difference between Enter and NumpadEnter. They are not included in the link you sent. It looks like the documentation on MDN is not completely up to date?
Thanks @GoGoris, I took a little closer look at this. Looks like NumpadEnter
is a valid value for event.code
. However, this module is intended to be used with event.key
. From the README:
[This module] provides an enum with string values that correspond with the
event.key
values
It looks like the event.code
value is Enter
for both regular Enter and the Numpad Enter:
(Screenshot taken from https://keycode.info/ in Firefox.)
Based on this, I think it is correct that this module not include NumpadEnter
. Maybe the best way forward would be to create a new module that is intended to be used with event.code
?
I'm going to close this for now, but I can reopen if you disagree 😄. Thanks for opening an issue!
Thanks! I did not know that event.key also returns a string. This makes my code so much simpler :)
Sorry for the confusion and thank you for your time!
No problem, glad it simplified your code 😄