WebExtensions command don't work when the key combination is used by the webpage
Categories
(WebExtensions :: Frontend, enhancement, P5)
Tracking
(firefox-esr60 affected, firefox67 affected, firefox68 affected, firefox69 affected)
People
(Reporter: yuki, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: parity-chrome, Whiteboard: [design-decision-approved])
Abstract
Any keyboard shortcut for a WebExtensions command doesn't work if the shortcut is already used by the webpage currently shown.
Steps to reproduce
- Install any addon providing commands, for example: Second Search. It provides a keyboard shortcut Ctrl-Shift-L by default to open its toolbar button popup.
- Open http://example.com/ in the current tab.
- Hit Ctrl-Shift-L to confirm the effectivity of the shortcut.
- Hit Ctrl-Shift-K to open the web console.
- Run a script:
addEventListener('keydown', e => { e.stopPropagation(); e.preventDefault(); }, true);
with the console. - Hit Ctrl-Shift-L.
Actual result
Nothing happen.
Expected result
The keyboard shortcut triggers its WebExtensions command.
Environment
- Firefox 67.0 (64bit, build ID: 20190516215225) on Windows 10
- Nightly 69.0a1 (64bit, build ID: 20190529215251) on Windows 10
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
•
|
||
This is a Firefox specific restriction, and doesn't happen onChromium (Google Chrome). Steps to reproduce:
- Install any extension with commands, for example Reopen closed tab Button™. It reopens most recently closed tab.
- Go to chrome://extensions/shortcuts
- Set keyboard shortcut Ctrl-Shift-L for Reopen closed tab Button™.
- Open http://example.com/ in the current tab.
- Hit Ctrl-Shift-L to confirm the effectivity of the shortcut.
- Hit Ctrl-Shift-J to open the web console.
- Run a script: addEventListener('keydown', e => { e.stopPropagation(); e.preventDefault(); }, true); with the console.
- Hit Ctrl-Shift-L.
Then the command is invoked and most recently closed tab is restored for me.
Reporter | ||
Updated•6 years ago
|
Comment 2•6 years ago
|
||
This is more or less expected. We use the same command key processing for extension commands as for built-in commands, and we allow those to be overridden by site key listeners.
Updated•6 years ago
|
Reporter | ||
Comment 3•6 years ago
|
||
Then, this looks related to another bug 1325692. Due to the restriction, now priority order of shortcuts are:
- Important shortcuts of Firefox itself (highest priority, impossible to change/disable, impossible to be overridden by anyone)
- Shortcuts defined by the webpage (impossible to change/disable)
- Regular shortcuts of Firefox itself (impossible to change/disable)
- Shortcuts for WebExtensions commands (lowest priority, possible to change/disable)
As the result, shortcuts provided by addons are actually almost unusable. Firefox now allows us to customize shortcuts on about:addons, but it looks almost mean-less, because shortcuts defined by Firefox and webpages are basically uncustomizable.
Originally this bug was reported as an issue of my addon, and its motivation is that allowing to use a fixed shortcut for features used by the user himself very frequently. So, I think the following order looks better:
- Important shortcuts of Firefox itself (highest priority, impossible to change/disable, impossible to be overridden by anyone)
- Shortcuts for WebExtensions commands (possible to change/disable)
- Shortcuts defined by the webpage (impossible to change/disable)
- Regular shortcuts of Firefox itself (lowest priority, impossible to change/disable)
because only shortcuts for WebExtensions commands are customizable/clearable by the user himself. How about this viewpoint?
Updated•5 years ago
|
Comment 4•3 years ago
|
||
We are not convinced that extensions taking precedence over everything else is the majority case.
However, we are supportive of a way for users to opt in to allowing extension shortcuts to take precedence over web pages (e.g. via the shortcut management page at about:addons). There are clearly use cases (e.g Vimium extension, bug 1713794), and the current alternative is the use of a global content scripts (which is a less reliable and worse performing solution than a built-in feature).
As for choosing extension shortcuts without conflicts, we would prefer offering a way to query the availability of a shortcut over somehow magically resolving conflicts (which is not feasible) - bug 1654403.
Patches are welcome.
Updated•2 years ago
|
Comment 5•1 year ago
|
||
This bug is growing more and more painful as a lot of websites find it's a good idea to remap lots and lots of keyboard shortcuts.
This makes a lot of firefox extensions break randomly.
This even makes Firefox (eg. quickfind) break randomly (please reopen #1455101)
Description
•