- From: Florian Bösch <pyalot@gmail.com>
- Date: Wed, 30 Jan 2013 15:11:40 +0100
- To: www-dom@w3.org
- Cc: Arthur Barstow <art.barstow@nokia.com>
- Message-ID: <CAOK8ODgcJtSm5dLSytGvXt=Xyx2TLY1O_VdScO2T5uk6UqQoWw@mail.gmail.com>
I have written a blog post at length about this issue here: http://codeflow.org/entries/2013/jan/30/keyboard-events-in-javascript-are-broken/ In short the problem is the following: - RIAs (shortcut systems) and Games (shortcut systems and action systems) need to be able to identify each key uniquely regardless of modifier keys pressed. - To make things mappable an unmodified primary symbol or description needs to be available to display to the user. - To make things speedy to handle there should also be an accompanying unmodified keyCode (numeric) The current event model (keyCode, charCode and which) do not satisfy that requirement: - The same keyCode appears on multiple keys - The same charCode appears (differently from keyCode) on multiple keys - charCode and keyCode change based on modifiers - keyCodes cannot be converted to a users locale - no non printable key descriptions are offered - "which" is a combination of all the problems above. It is recognized that this is not a good way to do things as for instance the MDN already lists "keyCode", "charCode" and "which" as deprecated. The DOM Event Level 3 does not solve all these problems: - The char member is still being delivered modified - The key member has to match the char member for printable keys - There is no numeric unmodified keyCode I would suggest: - Add a primary key symbol (printable, from the users locale) umodified and for non printable keys add the human readable description ('backspace', 'enter' etc.) - Add an additional unmodified key code member holding the numeric key code unmodified
Received on Wednesday, 30 January 2013 14:12:07 UTC