Re: DOM3 Key Events + accelerator keys

On Sep 25, 2007, at 8:47 AM, Bjoern Hoehrmann wrote:

>
> * Oliver Hunt wrote:
>> Obviously the spec should not (cannot?) define accelerators, but we
>> would ideally have some kind of specification to define what events
>> should be fired, and whether they should be allowed to prevent
>> default handling, etc.  It is these that it would be good to define.
>
> I am afraid it is not really clear to me where the specification is
> lacking in this regard. To give an example, my desktop has a launch
> mail application key. If I press it, the browser should not make that
> fact available to possibly malicious web sites, much less allow them
> to prevent me launching the mail application. In some other context
> it might well be appropriate to make the application aware of the key
> press and perhaps allow the application to prevent the default action.

Accelerator keys == key combos to hit menu items, such as ctrl/cmd- 
a,s,d,z,x,c,v,b,u,i,p,f...
All of these sequences generate events, but there is no definition  
for when they should be fired, nor whether they are cancelable.

> I do not understand what is unclear about what events should be fired,
> could you give a specific example of keyboard input and the possible
> interpretations of the current specification text?

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):
Safari 3 beta (3.0.4), Mac:
     * keyDown: U+0043, 67
     * keyPress: U+0043, 99

Firefox 2, Mac:
     * keyDown: undefined, 224
     * keyDown: undefined, 67
     * keyPress: undefined, 0
     * keyUp: undefined, 67
     * keyUp: undefined, 224

Firefox 3 alpha (3.0a6), Mac:
     * keyDown: undefined, 224
     * keyUp: undefined, 224

Opera 9.5 alpha (4404), Mac:
     * keyDown: undefined, 17
     * keyPress: undefined, 17
     * keyDown: undefined, 67
     * keyPress: undefined, 99
     * keyUp: undefined, 67
     * keyUp: undefined, 17

Internet Explorer 7, Win (obviously :D):
     * keyDown: undefined, 17
     * keyDown: undefined, 67
     * keyUp: undefined, 67
     * keyUp: undefined, 17

Firefox 2, Win:
     * keyDown: undefined, 17
     * keyDown: undefined, 67
     * keyPress: undefined, 0
     * keyUp: undefined, 67
     * keyUp: undefined, 17

Firefox 3 (3.0a6), Win -- identical to firefox 2, win.

Opera 9.5 alpha (9500):
     * keyDown: undefined, 17
     * keyPress: undefined, 17
     * keyDown: undefined, 67
     * keyPress: undefined, 67
     * keyUp: undefined, 67
     * keyUp: undefined, 17

In Firefox and Safari the ctrl/cmd-c accelerator can be cancelled,  
and so prevent the app itself from ever performing the copy.  IE does  
not send a keypress for the event, Opera sends keypress events for  
each key in the sequence, of the browsers that send keypress events  
there is no consensus on what the keyCode should be on the keypress.

--Oliver

Received on Tuesday, 25 September 2007 17:45:22 UTC