Closed Bug 1649278 Opened 4 years ago Closed 4 years ago

ESC doesn't dismiss <dialog> unless it is focused

Categories

(Core :: DOM: Core & HTML, defect, P2)

80 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: aja, Assigned: sefeng)

References

()

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0

Steps to reproduce:

On MDN page https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog on the "Advanced example", click "Update details" button, then press ESC without having focused the <details> "iframe".

Actual results:

ESC did not dismiss the <dialog>.

Expected results:

ESC should dismiss the <dialog>.

Assignee: nobody → sefeng

Somehow <select> implementation eats the esc key.

Severity: -- → S3
Priority: -- → P2

It turns out https://searchfox.org/mozilla-central/rev/e11d919cdc8a909354eb2c3e19904d9229c55d88/layout/forms/nsListControlFrame.cpp#2069 eats the event.

One challenge here is we don't have a flag to keep the status of the dropdown, and the dropdown is in the parent process, so it's hard to tell when should we preventing preventDefault().

Mike, do you have some suggestions?

Flags: needinfo?(mconley)

While the <select> dropdown panel is indeed rendered in the parent process, the content process is told (via SelectChild.jsm) that the panel is open via this ChromeOnly WebIDL attribute: https://searchfox.org/mozilla-central/rev/91d82d7cbf05a71954dfa49d0e43824c7c973e62/layout/forms/nsComboboxControlFrame.h#162-164

So perhaps you could use that boolean to determine whether or not the preventDefault on the keypress.

Flags: needinfo?(mconley)

We always use PreventDefault for <select> element, which is
problematic if modal dialog is on as it prevents cancelling
the dialog.

We fix it by not blocking the default action if <select> is
not shown.

Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/179606cffa67 Don't do PreventDefault for escape key if <select> dropdown is not shown r=smaug
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: