Re: ISSUE-23 (Key Indentifier Case): Should Key Identifiers prioritize uppercase characters [DOM3 Events]

Web Applications Working Group Issue Tracker:
> In the current draft of Key Identifiers, including the new algorithm
> wording, there is a bias toward uppercase characters. Essentially, if
> a key is pressed that gives a character codepoint which is lowercase,
> for which there is an uppercase equivalent, the uppercase codepoint
> (or character) is returned instead. What is the use case here?

The intention of that algorithm (if I remember my intention correctly
when writing it) is to provide guidance for implementors in choosing a
key identifier for a given key.  For example the 'A' key on many
keyboards (like QWERTY) has a primary function (i.e. without modifiers
pressed or locks enabled) of generating an 'a' character.  Given that
keyboards usually have the uppercase character printed on the keys,
using 'A' seemed to be nicer than 'a' as a key identifier.

> Case is a peculiar feature of Latinate languages, and it's not clear
> that special-casing it makes it easier to make reliable script. More
> reliable and flexible comparisons can be made easily; compare the
> following pseudocode snippets:
>
> // keyIdentifier reports only "Q", and forces all upper and lower case
> characters to the uppercase value
> if ( evt.keyIdentifier == "Q" ) { ... }
> 
> // keyIdentifier reports both "Q" and "q", and allows authors to
> // distinguish upper and lower case letters or lump them together, as
> // desired
> if ( evt.keyIdentifier.toLowerCase() == "q" ) { ... }

I’ve yet to see a keyboard that has a key for lowercase 'q' and
uppercase 'Q', so I don’t know that it makes sense to have two different
key identifiers for them.  Given the fact that the 'U+0051'-style of key
identifier is awkward, we should choose either 'Q' or 'q' here.

> Converting to uppercase strikes me as needless legacy from
> keyCode/charCode. Is there some pragmatic reason to force this
> casting?

These strings are meant to represent keys, rather than characters of
input.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Sunday, 29 June 2008 07:48:10 UTC