Closed
Bug 1433167
Opened 7 years ago
Closed 7 years ago
commands do not maintain userinput state for keyboard shortcuts
Categories
(WebExtensions :: General, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1408129
People
(Reporter: bugzilla, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20180104101351
Steps to reproduce:
At https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/browserAction/openPopup it is said:
"You can only call this function from inside the handler for a user action, such as:
... Activating a keyboard shortcut defined by the extension (note: this is not currently supported in Firefox)."
Why not? When will it be supported?
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Updated•7 years ago
|
Flags: needinfo?(mixedpuppy)
Comment 1•7 years ago
|
||
Anthony, is there a reason that the "Special Shortcuts" wont work for you?
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/commands
Flags: needinfo?(mixedpuppy) → needinfo?(arantius)
Reporter | ||
Comment 2•7 years ago
|
||
Well there's the fact that I didn't know it existed. I've submitted a revision to the docs ( https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/browserAction/openPopup$revision/1353229 ).
But actually, I want clicking the button to directly take an action (that is not opening the popup), so in my keyboard handler I want to `setPopup()`, then `openPopup()`. (Then `setPopup(null)`, probably at popup close time.) As best I can tell, this can only open the default popup, which I do not want to register.
Flags: needinfo?(arantius)
Updated•7 years ago
|
Flags: needinfo?(mixedpuppy)
Comment 3•7 years ago
|
||
The below example almost works for me, a key command is not maintaining that it is user input so the openPopup call fails.
in the manifest:
"background": {
"scripts": ["background.js"]
},
"commands": {
"open-popup": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
}
}
},
"browser_action": {
"default_title": "Test BrowserAction",
"browser_style": true
},
background.js:
browser.commands.onCommand.addListener(command => {
if (command == "open-popup") {
browser.browserAction.setPopup({popup: "panel.html"});
browser.browserAction.openPopup();
}
});
Status: UNCONFIRMED → NEW
Component: WebExtensions: Untriaged → WebExtensions: General
Ever confirmed: true
Flags: needinfo?(mixedpuppy) → needinfo?(mstriemer)
Summary: WebExtension: browserAction.openPopup() from keyboard shortcut → commands do not maintain userinput state for keyboard shortcuts
Comment 4•7 years ago
|
||
This looks like a dupe of bug 1392624. Currently user input is only accepted on extension pages, which is likely too strict.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(mstriemer)
Resolution: --- → DUPLICATE
Comment 5•7 years ago
|
||
IMO it would be easier to use the built-in command to open the browser action to a predefined popup page, and have that page dynamically change to your needs.
Comment 6•7 years ago
|
||
I'm also not completely convinced of the dup. onCommand listeners should probably always be treated as having user input.
Flags: needinfo?(mstriemer)
Flags: needinfo?(aswan)
Comment 7•7 years ago
|
||
(In reply to Shane Caraveo (:mixedpuppy) from comment #6)
> I'm also not completely convinced of the dup. onCommand listeners should
> probably always be treated as having user input.
Yep, that is bug 1408129.
Flags: needinfo?(aswan)
Comment 8•7 years ago
|
||
Looks like bug 1408129 is the commands case in bug 1392624. These two seem related but since one is about commands I'll move the dup.
Flags: needinfo?(mstriemer)
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•