Skip to content

Revert "Support mouse Back/Forward buttons in shortcuts" - #23350

Merged
AmethystLiang merged 1 commit into
mainfrom
revert-23287-nwparker/mouse-key
Sep 27, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
revert-23287-nwparker/mouse-key

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​572 $\color{#cf222e}{\Huge{\mathbf{−}}}$​567
Prod 20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 $\color{#cf222e}{\Huge{\mathbf{−}}}$​228 $\color{#cf222e}{\Huge{\mathbf{−}}}$​217

This reverts #23287 because it introduced a launch-blocking regression.

Saving a mouse Back/Forward shortcut and then rolling back the paired web app can drop that action's saved shortcuts, including keyboard shortcuts stored on the same action.

We will reland with a fix. A Linear ticket will track the reland.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run reviewed the single-commit revert of #23287 ("Support mouse Back/Forward buttons in shortcuts") — 27 files, 1 commit.

  • Mouse shortcut feature removed end to end. Deleted src/shared/mouse-shortcut-input.ts, src/renderer/src/lib/mouse-shortcut-dispatch.ts, and src/renderer/src/app-shell/register-app-mouse-shortcuts.ts, along with their unit tests, the main-process routing test, and the tests/e2e/mouse-button-shortcuts.spec.ts e2e spec.
  • Shared keybinding support reverted. parser.ts drops the MOUSEBACK/MOUSEFORWARD tokens, normalization.ts drops the isMouseButton bare-binding allowance, and formatting.ts drops the mouse labels.
  • IPC and renderer wiring removed. The ui:dispatchMouseShortcut handler is gone from main-window-shortcut-routing.ts (and the now-unused ipcMain import), dispatchMouseShortcut is gone from the preload surface, and use-global-keybindings.ts no longer registers the mouse dispatcher.
  • Pre-feature guards restored. terminal-workspace-keydown.ts returns to if (!activeWorktreeId) and use-hold-dictation-gesture.ts drops the recorder guard, matching the pre-#23287 behavior.
  • User-facing copy reverted. ShortcutCommandBlock.tsx, six locale JSONs, and docs/site/content/docs/settings.mdx no longer mention mouse Back/Forward recording.

Verification: grepped every removed symbol (MouseBack, MouseForward, dispatchMouseShortcut, parseMouseShortcutInput, registerMouseShortcutDispatch, and each deleted module name) — no dangling references remain. pnpm run tc:node and pnpm run tc:web both pass on the revert head.

ℹ️ Two non-blocking notes

  • config/scripts/ci-shard-timings.json still lists the deleted mouse-shortcut-dispatch.test.ts and mouse-shortcut-input.test.ts. This is harmless — balanceFiles iterates the actual test set and ignores unknown keys — so no change is needed; the next timing refresh drops them.
  • Users who saved a MouseBack/MouseForward binding while #23287 was live will, after this revert, have that action's entire override rejected on load: normalizeKeybindingArrayWithOptions returns on the first unparseable entry and parseBindingSection drops the action, so a keyboard shortcut sharing the same array is ignored too. This is the same failure class the revert targets, and a cleanup/preserve step plausibly belongs to the reland rather than here.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The changes remove Mouse Back/Forward shortcut parsing, recording, and dispatch, along with their associated tests. Keyboard shortcut routing remains. Keydown events that are already prevented or originate inside an active shortcut recorder now proceed through existing shortcut logic. Shortcut prompts and settings documentation no longer describe mouse-button shortcuts.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the regression and the intent to reland a fix, but it omits most required template sections, including ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, No… Complete the required template sections. Add the issue reference, visual proof or an N/A explanation, testing steps and platforms, review notes, compatibility considerations, checklist confirmations, and AI disclosure if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 files. (6 skipped: 6 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that the pull request reverts support for mouse Back/Forward buttons in shortcuts, which matches the main change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the regression and the intent to reland a fix, but it omits most required template sections, including ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Notes, and Checklist details.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Restore the recorder-target guard. · use-hold-dictation-gesture.ts:127

src/renderer/src/components/dictation/use-hold-dictation-gesture.ts:127
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Restore the recorder-target guard.

In hold mode, when voice dictation is enabled and an STT model is configured, this capture-phase handler can intercept a matching keydown before ShortcutRecorderButton receives it. It prevents recorder capture and can start dictation. The main-process recorder-focus safeguard only prevents before-input-event from consuming the shortcut; it does not bypass this renderer capture handler.

Suggested fix
     const handleKeyDown = (e: KeyboardEvent): void => {
+      if (e.target instanceof Element && e.target.closest('[data-shortcut-recorder-active]')) {
+        return
+      }
       if (keybindingMatchesAction('voice.dictation', e, getShortcutPlatform(), keybindings)) {

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cda256b3-cd53-4198-8e78-50ffacdc4c88

📥 Commits

Reviewing files that changed from the base of the PR and between 9f5a8a5 and 13a46fb.

📒 Files selected for processing (27)
  • docs/site/content/docs/settings.mdx
  • src/main/window/main-window-mouse-shortcuts.test.ts
  • src/main/window/main-window-shortcut-routing.ts
  • src/preload/api/ui-bridge-clipboard-and-window-controls.ts
  • src/preload/api/ui-window-api.ts
  • src/renderer/src/app-shell/register-app-mouse-shortcuts.ts
  • src/renderer/src/app-shell/use-global-keybindings.ts
  • src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx
  • src/renderer/src/components/dictation/use-hold-dictation-gesture.ts
  • src/renderer/src/components/settings/ShortcutCommandBlock.tsx
  • src/renderer/src/components/terminal-workspace-keydown.test.ts
  • src/renderer/src/components/terminal-workspace-keydown.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/mouse-shortcut-dispatch.test.ts
  • src/renderer/src/lib/mouse-shortcut-dispatch.ts
  • src/shared/keybindings-mouse.test.ts
  • src/shared/keybindings/formatting.ts
  • src/shared/keybindings/normalization.ts
  • src/shared/keybindings/parser.ts
  • src/shared/mouse-shortcut-input.test.ts
  • src/shared/mouse-shortcut-input.ts
  • tests/e2e/mouse-button-shortcuts.spec.ts
💤 Files with no reviewable changes (14)
  • docs/site/content/docs/settings.mdx
  • src/preload/api/ui-bridge-clipboard-and-window-controls.ts
  • src/renderer/src/app-shell/use-global-keybindings.ts
  • src/renderer/src/lib/mouse-shortcut-dispatch.test.ts
  • src/shared/mouse-shortcut-input.ts
  • src/preload/api/ui-window-api.ts
  • src/renderer/src/components/dictation/use-hold-dictation-gesture.ts
  • src/shared/keybindings-mouse.test.ts
  • src/renderer/src/app-shell/register-app-mouse-shortcuts.ts
  • src/renderer/src/lib/mouse-shortcut-dispatch.ts
  • src/shared/mouse-shortcut-input.test.ts
  • tests/e2e/mouse-button-shortcuts.spec.ts
  • src/main/window/main-window-mouse-shortcuts.test.ts
  • src/shared/keybindings/normalization.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

(event.target instanceof Element &&
event.target.closest('[data-shortcut-recorder-active]') !== null)
) {
if (!activeWorktreeId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep recorder keystrokes out of workspace shortcut handling.

When a user records a key that matches a workspace shortcut, this handler can now execute the workspace action instead of leaving the key solely to the recorder. For example, a matching key can call handleNewTab() while the recorder is active. Restore the active-recorder exclusion without restoring mouse shortcut support.

BACKQUOTE: 'Backquote',
MOUSEBACK: 'MouseBack',
MOUSEFORWARD: 'MouseForward'
BACKQUOTE: 'Backquote'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Inspect parser callers and handling of removed mouse tokens.
rg -n -C 6 'normalizeKeyToken|parseKeybinding|MouseBack|MouseForward' src --glob '*.{ts,tsx}'

Repository: stablyai/orca

Length of output: 21715


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- candidate files ---'
rg -l -i 'keybinding|shortcut|rollback|paired.?app|pair(ed)?' src --glob '*.{ts,tsx}' | head -80
printf '%s\n' '--- persistence and rollback references ---'
rg -n -i -C 5 'localStorage|sessionStorage|persist|override|rollback|paired.?app|sync.*(binding|shortcut)|binding.*sync' src --glob '*.{ts,tsx}' | head -500

Repository: stablyai/orca

Length of output: 43583


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -i -C 8 'keybinding|shortcut|override|rollback|paired|pairing|sync' . --glob '!node_modules' --glob '!dist' --glob '!build' --glob '*.{ts,tsx,js,jsx,json,md}' | head -1000

Repository: stablyai/orca

Length of output: 42010


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- keybinding module files ---'
git ls-files 'src/shared/keybindings/*' 'src/shared/*keybinding*' 'src/*/*keybinding*' | sort
printf '%s\n' '--- effective and override references ---'
rg -n -C 8 'getEffectiveKeybindingsForAction|getEffectiveKeybindingsForDefinition|KeybindingOverrides|keybindingOverrides|keybindings?Override|persisted.*keybinding|keybinding.*persist' src --glob '*.{ts,tsx}'
printf '%s\n' '--- state and paired-app exact references ---'
rg -n -C 8 'pairedApp|paired-app|pairedClient|pairing.*(rollback|restore)|rollback.*pair|restore.*keybinding|keybinding.*restore' src --glob '*.{ts,tsx}'

Repository: stablyai/orca

Length of output: 45655


🏁 Script executed:

#!/bin/bash
set -euo pipefail
files=(
  src/main/keybindings/keybinding-file.ts
  src/main/keybindings/keybinding-service.ts
  src/main/ipc/keybindings.ts
  src/renderer/src/store/slices/keybindings.ts
  src/renderer/src/components/settings/keybinding-override-edits.ts
  src/shared/keybindings/effective.ts
  src/shared/keybindings/normalization.ts
  src/shared/keybindings/types.ts
)
for file in "${files[@]}"; do
  printf '\n--- %s ---\n' "$file"
  wc -l "$file"
  rg -n -C 10 -i 'load|read|write|save|persist|restore|rollback|invalid|normalize|override|snapshot|mouseback|mouseforward|MOUSEBACK|MOUSEFORWARD' "$file" || true
done

Repository: stablyai/orca

Length of output: 33827


🏁 Script executed:

#!/bin/bash
set -euo pipefail
file=src/main/keybindings/keybinding-file-parser.ts
printf '%s\n' "--- $file ---"
wc -l "$file"
rg -n -C 18 'parseBindingSection|parsePlatformOverrides|removeConflictingOverrides|normalize|binding|invalid|diagnostic|actionId' "$file"

Repository: stablyai/orca

Length of output: 8046


Preserve valid shortcuts in mixed saved bindings.

readKeybindingFile passes each saved binding array to normalizeKeybindingArrayForAction. That normalizer rejects the whole array when it contains an invalid token. parseBindingSection then ignores the complete action. A saved action such as ["MOUSEBACK", "Mod+K"] can therefore lose its valid Mod+K shortcut. Filter invalid entries during file loading and retain valid entries. Do not convert an all-invalid array into an unintended empty override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant