W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

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

From: Masayuki Nakano <masayuki@d-toybox.com>
Date: Mon, 22 Aug 2011 15:15:48 +0900
Message-ID: <4E51F414.7080404@d-toybox.com>
To: "www-dom@w3.org" <www-dom@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT