fix(firefox): add browser-level keyboard shortcuts via commands API - #2727
Merged
webbrain-one merged 4 commits intoAug 10, 2026
Merged
Conversation
Firefox manifest.json had no 'commands' field, which meant browser-level keyboard shortcuts were not registered at all. The sidepanel.js keydown listeners only work when the panel has focus, which Firefox's sidebar_action does not reliably grant. This adds the same commands already present in the Chrome manifest (_execute_action → _execute_sidebar_action for Firefox MV2), plus custom commands for mode switching (Ctrl+Shift+A/X/D) and input focus (Ctrl+/) that the background script forwards to the side panel. Closes the parity gap where Firefox users could not use keyboard shortcuts to open the panel or switch modes.
|
@EvanLind is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Firefox browser-level shortcuts for opening the sidebar, switching modes, and focusing input.
Changes:
- Registers Firefox
commandsshortcuts. - Forwards commands from the background script.
- Dispatches commands within the side panel.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/firefox/manifest.json |
Defines shortcut commands. |
src/firefox/src/background.js |
Forwards custom commands. |
src/firefox/src/ui/sidepanel.js |
Handles mode and focus commands. |
Suppressed comments (2)
src/firefox/manifest.json:134
Ctrl+Shift+Dis Firefox's built-in “Bookmark All Tabs” shortcut, so Firefox gives the browser action precedence and this command will not fire with the proposed default. Use a non-conflicting suggested key for Dev mode.
"default": "Ctrl+Shift+D"
src/firefox/manifest.json:140
Slashis not a valid Firefox WebExtensions command key token, soCtrl+Slashcannot register throughcommands.suggested_keyand the browser-level focus shortcut will remain unavailable. Replace it with a supported key combination.
"default": "Ctrl+Slash"
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }, | ||
| "switch-to-ask": { | ||
| "suggested_key": { | ||
| "default": "Ctrl+Shift+A" |
Comment on lines
+2898
to
+2902
| browser.commands.onCommand.addListener((command) => { | ||
| // _execute_sidebar_action is handled natively by Firefox — no need to forward | ||
| if (command === '_execute_sidebar_action') return; | ||
|
|
||
| browser.runtime.sendMessage({ type: 'command', command }).catch(() => { |
Firefox's commands API does not accept 'Slash' as a valid key name. Valid keys are A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Space, Insert, Delete, Up, Down, Left, Right, and F1-F12.
…ndMessage runtime.sendMessage from background to sidepanel can be unreliable in Firefox when the sidepanel isn't fully loaded. Switch to storage.local set + storage.onChanged, which is guaranteed to fire in all extension pages regardless of load state. Also: - Keep the Ctrl+Period shortcut for focus-input - Add console.error logging on dispatch failure - Rebuild XPI
EvanLind
force-pushed
the
fix/firefox-keyboard-shortcuts
branch
from
August 10, 2026 14:43
fb248a9 to
ba9c886
Compare
Firefox won't allow inputEl.focus() to take effect if the sidebar panel doesn't currently have focus. window.focus() acquires sidebar focus first so the subsequent inputEl.focus() actually works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Firefox users cannot use keyboard shortcuts to open the WebBrain panel or switch modes. The
about:addons→ "Manage Extension Shortcuts" page lists WebBrain under "extensions without shortcuts."Root Cause
The Firefox
manifest.jsonhas nocommandsfield. The Chrome manifest already defines_execute_action(Alt+Shift+W), but the Firefox build was never updated to include the equivalent Firefox commands API.The existing shortcuts (Ctrl+/, Ctrl+Shift+A/X/D, Escape) are JavaScript
keydownlisteners insidepanel.jsthat only work when the side panel has keyboard focus — which Firefox'ssidebar_actiondoes not reliably grant.Changes
src/firefox/manifest.jsoncommandsfield with_execute_sidebar_action(Firefox MV2 equivalent of Chrome's_execute_action) and four custom commands for mode switching and input focussrc/firefox/src/background.jsbrowser.commands.onCommandlistener that forwards custom commands to the side panel viaruntime.sendMessagesrc/firefox/src/ui/sidepanel.jsruntime.onMessagelistener that handles forwarded commands by calling the existingsetMode(),ensureActMode(),ensureDevMode(), andinputEl.focus()functionsShortcuts
Alt+Shift+W_execute_sidebar_actionCtrl+Shift+Aswitch-to-askCtrl+Shift+Xswitch-to-actCtrl+Shift+Dswitch-to-devCtrl+/focus-inputAll shortcuts are user-configurable in
about:addons→ Manage Extension Shortcuts.