[DOM3 Events] Is KeyboardEvent.getModifierState() enough for web app developers?

Hello.

KeyboardEvent.getModifierState(keyArg) checks only a key state of 
keyArg.  In other words, it cannot check whether actual modifier key 
states are strictly same or not. For example, when a web app developer 
want to check Ctrl+Shift key for implementing shortcut key,

|event.getModifierState('Ctrl') && event.getModifierState('Shift')|

*might* not enough for the use. They might want to check as

|event.getModifierState('Ctrl') && event.getModifierState('Shift') &&
  !event.getModifierState('Alt') && event.getModifierState('AltGr')... |

On the other hand, if web application checked strictly, it may make 
serious a11y problem for some keyboard layout users. E.g., some keyboard 
layouts for Mac provides some ASCII characters only when Alt (Option) 
key is pressed.  Then, |!event.getModifierState('Alt')| blocks the 
expected behavior unexpectedly.

# 'Alt' is strange for 'Option' key of Mac, it's rather similar to 
'AltGr' according to this issue...

I think that the i18n of shortcut key issues are too difficult to be 
resolved by each web developer. If DOM3 would provide shortcut key 
registration mechanism at EventTarget, it would be great.

-- 
Masayuki Nakano <masayuki@d-toybox.com>
Manager, Internationalization, Mozilla Japan.

Received on Monday, 22 August 2011 06:15:46 UTC