W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

[DOM3Events] KeyboardEvent key and char clarification

From: Andrew Oakley <andrew@ado.is-a-geek.net>
Date: Thu, 26 Jan 2012 12:09:49 +0000
Message-ID: <4F21428D.3010505@ado.is-a-geek.net>
To: www-dom@w3.org
As far as I can tell the rules for these properties are as follows:

The 'char' property:
The text generated by this key given the current modifiers, including
dead keys but excluding composition keys and IME.  If there was no text
then it is the empty string.

The 'key' property:
If there is something appropriate in the key values list (,
then use the name in the table.  If the 'char' property is not the empty
string then the value of the 'char' property.  Otherwise we can make
something up (that matches [A-Z][0-9a-zA-Z]* and is fairly sensible).

At this point I'm confused by the character values in the key values
list - they appear to be the normal character values you would get for
the given key.

Why do we use 'Tab' as the key for the tab key rather than the relevant
character (\u0009)?  Other keys also have names even though there are
appropriate characters.

Section 6.2 says that the backspace key has a different character value
and key value, but this key is not listed in the key table and I would
expect both of these to be the Unicode backspace character (\u0008).

Have I misread the specification?

Andrew Oakley
Received on Thursday, 26 January 2012 12:10:33 UTC

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