Closed Bug 1443758 Opened 6 years ago Closed 6 years ago

Impossible to intercept Escape key in browser action pop-up


(WebExtensions :: Frontend, enhancement)

Not set


(Not tracked)



(Reporter: jwkbugzilla, Unassigned)


(Whiteboard: [design-decision-denied])

In my PfP: Pain-free Passwords extension, I do the following in the browser action pop-up to handle Escape key presses:

> document.addEventListener("keydown", event =>
> {
>   if (event.key == "Escape")
>   {
>     ...
>     event.preventDefault();
>   }
> });

This works correctly in Chrome 64, the extension can handle Escape key (trigger its "cancel" action) and the pop-up doesn't close. In Firefox 60.0a1 (2018-03-02 nightly) the pop-up will always closed however, the extension doesn't even see the Escape key.
Whiteboard: [design-decision-needed]
Severity: normal → enhancement
Hi Wladimir, this has been added to the agenda for the WebExtensions APIs triage on April 3, 2018. Would you be able to join us? 

Here’s a quick overview of what to expect at the triage: 

* We normally spend 5 minutes per bug
* The more information in the bug, the better
* The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details

Relevant Links: 

* Wiki for the meeting:
* Meeting agenda:
* Vision doc for WebExtensions:
I'm afraid that the time isn't great for me. I'll try to join but most likely I won't be there.
Emanuela, can you provide some UX guidance on this feature request? Allowing extensions to capture and handle the ESC key could prevent users from closing a browser action popup window via ESC.  There are, however, other methods of closing a browser popup, mostly easily by simply clicking outside the popup window.

Do we need to preserve the "ESC key closes the browser action popup" behavior? Or would we be okay letting extensions capture the ESC key for their own purposes since there are other ways of closing a browser action popup?
Flags: needinfo?(emanuela)
Hi Mike, I'll look into it and I will provide some guidelines.
Flags: needinfo?(emanuela)
Whiteboard: [design-decision-needed] → [design-decision-needed][needs-follow-up]
I believe it's better to maintain the 'Esc' behavior as it is. So people who cannot use a mouse or other pointing device, or who want to use a keyboard as much as possible, can still dismiss the pop-up.
Closed: 6 years ago
Resolution: --- → WONTFIX
Whiteboard: [design-decision-needed][needs-follow-up] → [design-decision-denied]
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.