W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

[DOM3 Events] space key should be always "Spacebar" for KeyboardEvent.key?

From: Masayuki Nakano <masayuki@d-toybox.com>
Date: Thu, 09 May 2013 14:33:52 +0900
Message-ID: <518B3540.7010103@d-toybox.com>
To: "www-dom@w3.org" <www-dom@w3.org>
CC: Karl Tomlinson <karlt@mozbugz.karlt.net>, "Gary Kacmarcik (Кошмарчик)" <garykac@chromium.org>, Travis Leithead <travis.leithead@microsoft.com>
Hello, when we implement KeyboardEvent.key for non-printable keys on 
Gecko, there is a discussion about implementing on Linux. I'd like to 
confirm the W3C staff's intent about "Spacebar".

https://bugzilla.mozilla.org/show_bug.cgi?id=842927#c93

> KEY_MAP_GTK     (Spacebar, GDK_space)
> KEY_MAP_GTK     (Spacebar, GDK_KP_Space)
> KEY_MAP_GTK     (Spacebar, GDK_nobreakspace)
> KEY_MAP_GTK     (Spacebar, GDK_emspace)
> KEY_MAP_GTK     (Spacebar, GDK_enspace)
> KEY_MAP_GTK     (Spacebar, GDK_em3space)
> KEY_MAP_GTK     (Spacebar, GDK_em4space)
> KEY_MAP_GTK     (Spacebar, GDK_digitspace)
> KEY_MAP_GTK     (Spacebar, GDK_punctspace)
> KEY_MAP_GTK     (Spacebar, GDK_thinspace)
> KEY_MAP_GTK     (Spacebar, GDK_hairspace)
>
> These are all printable keysyms.  I don't know whether or not that matters,
> but it doesn't seem right to map them all to the same key value.  Many, if not
> all, of these would have a Unicode code point so doesn't 1.2 of "6.2.6
> Guidelines for selecting and defining key values" mean that the Unicode point
> should be used?

I was thinking (still think) that space like character is inputted only 
with physical spacebar key of any keyboard layout.  If so, the .key 
value should be always "Spacebar" rather than actual input character.

Therefore, I tried to map these white space like character keys as 
"Spacebar". And when the pressed key generates ASCII space (U+20) or 
non-brekable space (U+A0) with/without shift key (because there is no 
way to know whether the pressed key is physical space key or not on 
Linux), I tried to map such key as "Spacebar". However, the code 
reviewer, Karl Tomlinson, believed that in such case, the 1.2 of section 
6.2.6 is better than 1.1.

I believe that "Spacebar" value is useful if web apps want to handle the 
spacebar as a (part of) shortcut key. Therefore, I believe that even if 
physical space key generates any characters, the key event's .key value 
should be "Spacebar" (i.e., should be used rule 1.1).

FYI: on Windows and on Mac, physical space key event generates only one 
virtual keycode event, therefore, .key is always set "Spacebar", 
independent from actual input character.

My question is, How D3E spec staff think that whether "Spacebar" should 
be used or not when space key inputs non-ASCII space character. I.e., 
should be used rule 1.1 or 1.2 of section 6.2.6.

Regards,

-- 
Masayuki Nakano <masayuki@d-toybox.com>
Manager, Internationalization, Mozilla Japan.
Received on Thursday, 9 May 2013 05:34:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC