Define constants for legacy KeyCode use #2222

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@TV4Fun
Contributor

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.

Define constants for legacy KeyCode use
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

This comment has been minimized.

Show comment
Hide comment
@juj

juj Mar 13, 2014

Collaborator

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?

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@TV4Fun

TV4Fun Mar 13, 2014

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@kripken

kripken Mar 14, 2014

Owner

Agreed.

Owner

kripken commented Mar 14, 2014

Agreed.

juj added a commit that referenced this pull request Mar 14, 2014

Add better documentation to emscripten/html5.h KeyEvent structure on …
…the current implementation and deprecation status of the various fields. See also pr #2222.
@juj

This comment has been minimized.

Show comment
Hide comment
@juj

juj Mar 14, 2014

Collaborator

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.

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@TV4Fun

TV4Fun Mar 16, 2014

Contributor

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

Contributor

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