Polyfill and normalize HTML5 "key", deprecates which and keyCode #607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements the HTML5
keyproperty for all browsers and normalizes behavior of those that already do, only special keys are supported. Non-special keys cannot be supported because they depend on the user's keyboard layout which cannot be determined, among other things. IE (IE9+ even) and latest FF both support thekeyproperty, but they are broken for anything but special keys.Deprecates my PR #502, while you can listen to other values for which and keyCode, doing so relies on the user having a specific keyboard layout, which is quite simply broken behavior (and quite dangerous as it is not immediately apparent).
So all-in-all, this is pretty much as good and reliable as is humanly possible today, in any browser, and it's compatible with the future of HTML5.
Why would you want this? If you're making a webapp that should be in any way "keyboard friendly", like say, listen to enter in a field, or support pressing the arrows keys in a slideshow, then you need this, or you need to make it yourself. In my opinion, this is a hugely useful feature that is quite broken by default in browsers and something that should be solved and not thrust upon the users.
You can play with it here: http://dev.cetrez.com/jsx/ (check the console)