Skip to content
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

Find Alternative to KeyboardEvent.which #15

Open
tommagnusson opened this issue Sep 14, 2018 · 0 comments
Open

Find Alternative to KeyboardEvent.which #15

tommagnusson opened this issue Sep 14, 2018 · 0 comments

Comments

@tommagnusson
Copy link
Contributor

Mozilla developer network has marked KeyboardEvent.which to be deprecated and nonstandard, even though most browsers have implemented it (albeit in an non-unified fashion).

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which

Considerations:

  • keyCode and charCode are also both deprecated, with inconsistent browser support.
  • key is current and standard, however it does all the work that we're doing to take into account shift, locale, etc.
  • keyIdentifier seems to be a highly unimplemented and nonstandard stunt pulled by Safari (the only one to possibly implement it).
  • code might be a correct alternative. It represents which button on a device is pressed, without any consideration for what character that button is supposed to generate. This might be low level enough to keep student struggles aloft, but standard enough to work consistently in many browsers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant