Accesskey bindings don't respect Event.preventDefault()
Reported by
93m...@gmail.com,
May 6 2016
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36 Steps to reproduce the problem: 1. Open https://jsfiddle.net/kaeshys7/ 2. Focus the bottom right frame. 3. Press alt-f. What is the expected behavior? The event has no visible effect. What went wrong? The <input> is focused using its access key, even though preventDefault was called on the event. Did this work before? No Chrome version: 49.0.2623.112 Channel: stable OS Version: Flash Version: Shockwave Flash 21.0 r0 The spec seems to indicate that preventDefault should stop the action: [https://www.w3.org/TR/uievents/#h-event-flow-activation] "An activation trigger is a user action or an event which indicates to the implementation that an activation behavior should be initiated. User-initiated activation triggers include clicking a mouse button on an activatable element, pressing the 'Enter' key when an activatable element has focus, or pressing a key that is somehow linked to an activatable element (a hotkey or access key) even when that element does not have focus." ... "Preventing the default action of the activation trigger, such as with the Event.preventDefault(), must stop the initiation of the activation behavior."
,
May 9 2016
We should probably verified that this code does in fact still make sense: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/input/EventHandler.cpp&q=handleAccessKey&sq=package:chromium&l=3180 As it seems we explicitly dispatch the handling access key 'before' the keydown event is processed.
,
May 30 2016
Tested on Windows, Linux and Mac: 1. Chrome is Matching Safari and Edge (won't cancel Accesskey); 2. Firefox is different from others (will cancel Accesskey, seems matching spec). Gary@, should we match Firefox or stay with Safari and Edge?
,
Jun 8 2017
I believe it is reasonable to do as firefox does. The access key actually is preventable. Maybe we want to add a use counter about how many times an access key is invoked yet the keyboard event was prevent defaulted. Ella can you add that?
,
Jun 9 2017
FireFox is handling the accesskey in the keydown message whereas Chrome does it in the keypress handler. Edge doesn't allow the event to be prevent defaulted at all.
,
Jun 9 2017
,
Jun 9 2017
It was decided we will check to see if there is an access key handler for the element in the keydown and count the prevent defaulted numbers vs not. If this number is relatively low we will propose changing chromium's implementation to be in keydown which and preventable like FireFox is.
,
Sep 29 2017
,
Sep 29 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by cbiesin...@chromium.org
, May 9 2016