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

Define constants for legacy KeyCode use #2222

Closed
wants to merge 1 commit into from

Conversation

@TV4Fun
Copy link
Contributor

@TV4Fun TV4Fun commented Mar 12, 2014

The HTML5 spec for KeyboardEvents is still a draft, any many browsers
(Chrome and Firefox included) still have yet to implement support for it.
Unfortunately, this means that to use keyboard input in these browsers,
we still have to rely on legacy keyCode support. This implements the keyCode
definitions provided at
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Virtual_key_codes,
which will work in Chrome and Firefox, and probably other browsers as well.

The HTML5 spec for KeyboardEvents is still a draft, any many browsers
(Chrome and Firefox included) still have yet to implement support for it.
Unfortunately, this means that to use keyboard input in these browsers,
we still have to rely on legacy keyCode support. This implements the keyCode
definitions provided at
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Virtual_key_codes,
which will work in Chrome and Firefox, and probably other browsers as well.
@juj
Copy link
Collaborator

@juj juj commented Mar 13, 2014

I feel a bit uncertain about merging this in, since it's deprecated functionality and will not work consistently across browsers. I think it would be better as a wiki page or a gist, which we could perhaps point to in the html5.h documentation, saying "if you really want to do this, then here's stuff you can copy-paste." How does that sound?

@TV4Fun
Copy link
Contributor Author

@TV4Fun TV4Fun commented Mar 13, 2014

That seems reasonable enough. However, I would also recommend adding some extra notes to the headers saying that the spec is still a draft and many members of that KeyboardEvent struct do also not work consistently across browsers.

@kripken
Copy link
Member

@kripken kripken commented Mar 14, 2014

Agreed.

juj added a commit that referenced this issue Mar 14, 2014
…the current implementation and deprecation status of the various fields. See also pr #2222.
@juj
Copy link
Collaborator

@juj juj commented Mar 14, 2014

Ok, I updated the documentation. If this proves to become a big pain for several developers, I guess we should research up the status in different browsers in close detail and offer a best practices wiki page, or a very light abstraction layer to unify everything, or something similar. @TV4Fun, let me know if the wording I now added did not feel like it hit the spot.

@juj juj closed this Mar 14, 2014
@TV4Fun
Copy link
Contributor Author

@TV4Fun TV4Fun commented Mar 16, 2014

That seems like a good compromise to me. The note seems reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants