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

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

From: Ojan Vafai <ojan@chromium.org>
Date: Tue, 25 May 2010 20:28:28 -0700
Message-ID: <AANLkTinIMFyLGlyunQ_ujUSzMhxvfW3ZzX4QBQUirKUX@mail.gmail.com>
To: Jacob Rossi <rossi@gatech.edu>
Cc: "Hallvord R. M. Steen" <hallvord@opera.com>, www-dom@w3.org, Erik Arvidsson <arv@chromium.org>, Alex Russell <slightlyoff@chromium.org>
On Tue, May 25, 2010 at 7:32 PM, Jacob Rossi <rossi@gatech.edu> wrote:

> In my opinion, .key would not be an empty string for
> character-producing keys. The spec gives a key name for every key
> (regardless of whether it produces a character) and this should be the
> value of .key. Keeping it this way allows for easy programming around
> 2 common scenarios:
>
> a.  You care which key was pressed (.key)
> b. You care which character was produced (.char)
>
> If .key is an empty string for character-producing keys, then in
> scenario A you would have to consciously decide whether to use .key or
> .char based on whether the key produces a character or not.
>
> To simplify scenario A, I would prefer .key always have a value. A key
> is never abscent of a name. Rather, sometimes it just doesn't produce
> a character.


I buy that argument.
Received on Wednesday, 26 May 2010 03:59:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:04 GMT