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

what should event.key be if a key inserts multiple characters?

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Tue, 18 May 2010 22:02:13 +0200
To: www-dom@w3.org
Message-ID: <op.vcw29zyga3v5gv@hr-opera.oslo.opera.com>
I assume the intention of event.key as specified is to be able to  
distinguish any key on the keyboard by their input or key name. Here's a  
question that was concerning me: say one uses a keyboard definition that  
maps certain keys to multiple characters. For example, if keys are  
configured to insert strings like "Up", "Down", "Left", "Right", "End",  
"Esc", "Home".. It seems to me that event.key would be set to the  
corresponding string and there would be no way in our API to distinguish  
such a key press from pressing the actual up/down/left/right arrow, end,  
esc or home keys.

Is that intentional?

(FWIW, personally I think it would be nicer to have event.key and  
event.keyName rather than trying to conflate the two into one property.  
Don't remember if I already suggested that and it was rejected.)

Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/
Received on Tuesday, 18 May 2010 20:03:06 UTC

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