W3C home > Mailing lists > Public > public-webapi@w3.org > August 2007

Key Events internationalization

From: Richard Ishida <ishida@w3.org>
Date: Wed, 29 Aug 2007 17:16:00 +0100
To: <public-webapi@w3.org>
Cc: <public-i18n-core@w3.org>
Message-ID: <009f01c7ea57$e3e50580$6701a8c0@rishida>

[Forwarding to the webapi folks an edited version of an earlier message to i18n]


One thing I currently don't have a clear grasp of is the following:

The DOM appendix A gives an example of pressing the key engraved with Q on a US physical kbd with a serbian mapping applied.  The example quotes the result as "keydown": "U+0409".  How is the implementation supposed to figure out that the appropriate identifier is U+0409, when all the tests I've done have returned the 81 (Q) result.

Does the implementation have tables for every keyboard mapping and every physical keyboard, and use those to map the codes coming from the keyboard into the right identifier?  Is so, how would it handle user customised keyboards in an interoperable way?  Or is it using the textInput value to work this out? Wouldn't it be better to just go with the codes sent by the keyboard to identify a key without trying to figure out what the character was?


I wrote a small web app to help me.  It shows what current browsers do when you hit a key wrt assignments to .keyCode and .charCode on a keyDown, keyUp or keyPress event. (See http://people.w3.org/rishida/utils/keyevents/ if you're interested)

This produced different results from the Java app I had been using...  Eg. the Ukrainian keys that produced key codes of 0 (ie. ; ' [ ] etc) actually produce codes in browsers, but different codes depending on which browser you use. Eg. the ; key produces

		keydown	keypress	keyup
Ie		186 (º) 	1078 (ж) 	186 (º) 
Ff		59 (;)  	1078 (ж) 	59 (;)
Opera		1046 (Ж)	1078 (ж)	1046 (Ж)
Safari	186 (º)	1078 (ж)	186 (º)

Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)
Received on Wednesday, 29 August 2007 16:13:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:09:57 UTC