Capture escape keypresses in popup to close overlay?
sebastian.ober at posteo.de
Tue Nov 7 23:03:24 UTC 2017
I noticed that as opposed to in Chrome, I cannot listen on Escape key
presses in the extension popup. My use case was that I open a "modular
window" (being an overlayed div in my case) inside the popup on certain
user actions. I wanted to allow users to close that modular overlay by
using the escape key. In Chrome, that works, in Firefox, it direcly
closes the whole popup despite e.preventDefault() and e.stopPropagation().
While this is intended behaviour, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1373175, I was wondering if
anyone knows a way to offer something like an escape keypress to close
an overlay inside the popup. Of course, I could use a different key
combination, but that would not be intuitive in my opinion. Maybe there
is a clever, accepted solution I am not aware of?
More information about the Dev-addons