Re: Question about key identifiers

Hi, Maciej-

Maciej Stachowiak wrote (on 9/21/09 11:11 AM):
>
> When the key identifier list has multiple equivalent key identifiers for
> a certain key, which should implementations provide in KeyboardEvents?
> Here is an example:
>
> 'Q'
> 'U+0051'
> The Latin Capital Letter Q key (Q).
>
> When the user presses Q, will the keyIdentifier attribute of the
> keydown, keyup and keypress events contain the string "Q", "U+0051", or
> either one at the implementation's discretion?
>
> My preference would be that implementations MUST use the first
> (human-readable) name, as that is the most natural.

That is the intent, and it's spelled out in the key identifier selection 
algorithm, and explicitly stated in prose in the section describing Key 
Identifiers [1].

It's a key point to get across, though, so I've restated it in the key 
identifiers section.

Note that this is a change from the W3C Note, and from versions of the 
spec before I became editor, and it doesn't match the behavior of WebKit 
(which is the only desktop Web engine I know of to support 
.keyIdentifier).  However, a early-adopter implementer (BitFlash, a 
mobile SVG UA) got a lot of negative feedback from authors regarding the 
"U+xxxx" strings rather than the character string, so they actually 
changed their own behavior.  I strongly agree that this is a major pain 
in the ass for authors, so I introduced the character-string aspect, and 
the cascade of which values to present.


> I think it would be a serious problem if implementations were allowed to
> provide any of the keyIdentifiers, as then scripts would have to check
> for each possibility, and likely authors wouldn't get this right.

Agreed.  They can always convert to Unicode code point or key name using 
the convertKeyIdentifier method, so they have all the options available 
if they need them.


> Currently all the examples seem to use the "U+0051" style, but nothing
> seems to make that a normative requirement.

That's a throwback to earlier drafts, and I missed that forest for the 
trees.  Thanks for pointing it out.


> Please clarify this in the spec, and if the human-readable style is made
> a requirement, please update the examples to use it instead of the
> U+00xx style.

Done.

[1] 
http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#keyset-keyidentifiers


Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs

Received on Tuesday, 22 September 2009 03:36:18 UTC