Re: DOM3 Key Events + accelerator keys

* Oliver Hunt wrote:
>All of these sequences generate events, but there is no definition  
>for when they should be fired, nor whether they are cancelable.

Well I don't see how these definitions are absent. You get a keydown if
a key is pressed down. You get a keyup if a key is released. keyup and
keydown events generated by the DOM Events implementation are always
cancelable, that is, you can call preventDefault on them, and after the
method is called, the .defaultPrevented attribute is set to true. There
is no definition beyond that what it means to cancel them in this case.

>Currently the 4 browsers, Safari, Opera, IE, and Firefox al do  
>slightly different things, for instance when hitting ctrl-c (or cmd-c  
>on mac):

I cannot comment on keypress and the .keyCode attribute as there is no
proposal how to define them at the moment, and I understand that browser
behavior is inconsistent, but I do not understand how this is a problem
of the specification. For example:

>Safari 3 beta (3.0.4), Mac:
>     * keyDown: U+0043, 67
>     * keyPress: U+0043, 99

Reading the specification, I would expect (assuming you release the
Cmd-key last, and omitting keypress, .keyCode, etc.):

  1. keydown, "Meta"
  2. keydown, "U+0043"
  3. keyup, "U+0043"
  4. keyup "Meta"

I do so because section 1.8.4 says the Macintosh Cmd-key is represented
using the Meta modifier, whose key identifier is defined to be "Meta",
and because appendix A.1.1 say modifier keys generate keydown and keyup
events just like any other keys.

I can see no justification for what the Safari Beta does here in the
specification (not generating key events for modifier key presses, and
not generating a keyup event even though a key has been released). If
you could tell me why this is a good choice and how you read the draft
to suggest that this choice is also conforming, that would be great.

Whether preventing the default action of any of the events during a
CTRL+C combination will prevent the browser from copying the selected
text into the clipboard is out of scope of the specification. As user
I would find that annoying in most cases.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 25 September 2007 19:12:23 UTC