Issue metadata
Sign in to add a comment
|
Escape Key press event is passed to web page when context menu is open
Reported by
wirch.ed...@gmail.com,
Dec 1 2016
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Type some words in a text box. Make sure the text box has a ESC key handler, so you will see if the text box handles the key press. 2. Right click on a word. The context menu appears. 3. Press ESC. The context menu closes as expected. But the text box does handle the ESC key as well. What is the expected behavior? If the context menu is open, the ESC key is intended for the context menu. When pressed, the context menu should process (and swallow) the key press event. What went wrong? The key press event is passed down to the web page. In some cases this leads to closing web dialogs and thus loosing data. Sometimes a lengthy text, which is really annoying. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 54.0.2840.99 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 23.0 r0
,
Dec 3 2016
Could you provide reproducible bit of code (on jsbin or jsfiddle) that illustrates the problem you're experiencing? Quickly testing it on http://www.quirksmode.org/dom/events/tests/keys.html appears to work as intended for me.
,
Dec 3 2016
Can reproduce on 55.0.2883.28 beta (64-bit, Linux) using the link in #2.
,
Dec 6 2016
Sorry, it looks like I've been not carefully enough creating this issue. In fact, Chrome and Firefox behave the same, unlike claimed. When ESC is pressed while the context menu is open, the page element will receive the keyup event (not the keydow and not the keypress events). It's unclear if this behavior is to be considered 'desired'. I observed the misbehavior in JIRA. The comment text box in JIRA will loose focus when ESC is pressed. It will also loose focus when the context menu is open. It looks like JIRA tied the loose-focus event handler to keyup. Does it make sense to send a event to the text box which was not intended for it?
,
Dec 6 2016
Testing the link in #2. The first key down dismisses the popup dialog and the focus then is in the document again so it gets the keyup message. Be aware that another keydown may come to the text input field in the case of key repeat. It sounds like that you should be handling only the keydown with no repeat set in your event handler. The same happens in FireFox; both browsers are working as designed. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by ligim...@chromium.org
, Dec 1 2016