Closed Bug 1323917 Opened 7 years ago Closed 7 years ago

Specify that key command event listeners only work in background

Categories

(Developer Documentation Graveyard :: Add-ons, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: kumar, Unassigned)

Details

I was reading this guide on key commands: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands

And I was trying to add the browser.commands.onCommand.addListener(...) code to my popup (which sort of makes sense in the context of my extension). This doesn't work but there are no errors. You just never get the events.

The docs should make it clear that you need to listen to this event in a background script.
No longer depends on: 1322750
It works for me (Firefox 52), if the popup is open. If the popup is closed, it doesn't of course, because its document isn't loaded.
oh man! I know what was happening. I was testing it on a website that uses Flash which disables all key commands. It worked in the background because no Flash. Thanks for helping me regain my sanity :) It is working for me from the popup on non-Flash sites.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.