Define constants for legacy KeyCode use#2222
Define constants for legacy KeyCode use#2222TV4Fun wants to merge 1 commit intoemscripten-core:incomingfrom
Conversation
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.
|
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? |
|
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. |
|
Agreed. |
…the current implementation and deprecation status of the various fields. See also pr #2222.
|
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. |
|
That seems like a good compromise to me. The note seems reasonable. |
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.