Open Bug 1411864 Opened 7 years ago Updated 2 years ago

pressing the ESC or ENTER key on window.prompt triggers keyup

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P2)

56 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: gut.kevin, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce:

- Load a website that contains a "window.prompt" dialog.
- Trigger said dialog.
- Press ESC or ENTER to trigger the bug.



Actual results:

Pressing ESC or ENTER triggers a keyup event on the document Element.


Expected results:

The keyup event should not be triggered. The two keys that trigger it are especially problematic because they are also used on some sites to confirm and abort actions.
Component: Untriaged → Event Handling
Product: Firefox → Core
I was going to make this block 'eviltraps' but it seems like it's not even malicious. Stone, do you know if we're doing something weird here?
Flags: needinfo?(sshih)
Priority: -- → P2
Tested with Edge and Chrome, both of them fire keyup when pressing ESC to dismiss the dialog. Tested with Firefox, it doesn't fire keyup when normally press and release ESC. But it fires keyup to the document element when holding the ESC for a while and release it.
Flags: needinfo?(sshih)
(In reply to Ming-Chou Shih [:stone] from comment #2)
> Tested with Edge and Chrome, both of them fire keyup when pressing ESC to
> dismiss the dialog. Tested with Firefox, it doesn't fire keyup when normally
> press and release ESC. But it fires keyup to the document element when
> holding the ESC for a while and release it.

Regarding the case we don't fire keyup to the document, I think that's because we asynchronously dismiss the dialog and dispatch keyup to the dialog.

[1] http://searchfox.org/mozilla-central/rev/7e090b227f7a0ec44d4ded604823d48823158c51/toolkit/components/prompts/content/tabprompts.xml#292
Component: Event Handling → User events and focus handling
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: