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

In D3E the 'key' field indicates the meaning of the key in the current
context, so in this case it would be appropriate for it to have distinct
values for each of the cases listed.  The D4E 'code' field is intended to
indicate the actual key that was pressed, regardless of its meaning in the
current context, so that would be consistent for the spacebar, regardless
of the generated KeySym.

In this case I'd recommend:
* For the "space" and "KP_Space" key-syms, generate Spacebar (NORMAL) and
Spacebar (KEYPAD) events, respectively.
* For the others, generate events using the corresponding Unicode code
point for the 'key' field.


On 8 May 2013 22:33, Masayuki Nakano <masayuki@d-toybox.com> wrote:

> 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<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 21:26:55 UTC