Closed Bug 1373175 Opened 7 years ago Closed 7 years ago

Cannot suppress escape keypress event in WebExtension in Firefox

Categories

(WebExtensions :: Frontend, defect)

54 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: preetsaimutneja, Unassigned)

Details

(Whiteboard: [design-decision-denied] triaged)

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

Steps to reproduce:


I have a WebExtension in which I want to handle escape keypress event on an element. In the event handler, I have the following 2 lines that I thought would help me achieve the desired behavior.

escKeydownHandler = (event) => {
  if(isEscapeKey(event)) {
    // do something here
    // ...
    event.preventDefault();
    event.stopImmediatePropagation();
  }
}
I expect that this would not force the extension to close. And this works fine if I load the same extension in chrome i.e. the extension does not closes. However, it does not work in Firefox. When I press escape on the element which has the above event handler attached in Firefox, the extension closes. Why am I doing wrong ? Is this any way to achieve the desired behavior ?


Actual results:

When I press escape on the element which has the above event handler attached in Firefox, the extension closes.


Expected results:

I expect that this would not force the extension to close.
Component: Untriaged → WebExtensions: Frontend
Product: Firefox → Toolkit
Whiteboard: [design-decision-needed] triaged
Hi preetsaimutneja, this has been added to the agenda for the August 8 WebExtensions APIs triage. Would you be able to join us? 

Wiki: https://wiki.mozilla.org/Add-ons/Contribute/Triage#Next_Meeting

Agenda: https://docs.google.com/document/d/1I-i1FQ38nwFHNl4hnzTctdsYHXOjJpeAgm1Bm3VoUUA/edit#heading=h.ixspnh6vr384
Flags: needinfo?(mixedpuppy)
esc is a standard binding across firefox for closing things, I'd rather not see addons being able to change that behavior, it would lead to confusion.  If you have a convincing use case for this let us know.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mixedpuppy)
Resolution: --- → WONTFIX
Whiteboard: [design-decision-needed] triaged → [design-decision-denied] triaged
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.