Skip to content

Add mouse side-button tab navigation - #6669

Open
sdhilip200 wants to merge 2 commits into
stablyai:mainfrom
sdhilip200:codex/mouse-side-button-navigation
Open

sdhilip200 wants to merge 2 commits into
stablyai:mainfrom
sdhilip200:codex/mouse-side-button-navigation

Conversation

@sdhilip200

@sdhilip200 sdhilip200 commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds Mouse4/Mouse5 support for previous/next visible tab navigation in Orca chrome.
  • Handles Electron browser-backward / browser-forward app commands from the main window so side-button navigation also works when Electron emits app-command events.
  • Adds focused coverage for both the main-window app-command path and the renderer mouse-event hook.

Closes #6658.

Screenshots

No visual change.

Testing

  • ./node_modules/.bin/vitest run --config config/vitest.config.ts src/main/window/createMainWindow.test.ts src/main/browser/browser-guest-ui.test.ts src/renderer/src/hooks/useMouseTabNavigation.test.tsx
  • ./node_modules/.bin/oxlint src/main/window/createMainWindow.ts src/main/window/createMainWindow.test.ts src/main/browser/browser-guest-ui.ts src/main/browser/browser-guest-ui.test.ts src/main/browser/browser-manager.ts src/renderer/src/App.tsx src/renderer/src/hooks/useMouseTabNavigation.ts src/renderer/src/hooks/useMouseTabNavigation.test.tsx
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.node.json
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.web.json
  • ./node_modules/.bin/tsgo --noEmit -p config/tsconfig.tc.cli.json
  • git diff --check

AI Review Report

  • Cross-platform check: renderer MouseEvent.button handling covers normal app chrome without OS-specific code; Electron app-command handling covers browser-backward / browser-forward events emitted for mouse back/forward buttons on supported desktop platforms.
  • Regression check: the implementation reuses the existing ui:switchTabAcrossAllTypes / handleSwitchTabAcrossAllTypes tab navigation path instead of introducing a separate tab-history model.
  • Scope check: no UI layout, persistence, browser page navigation, or keybinding behavior changes were introduced.

Security Audit

  • No new IPC channels or privileged renderer APIs were added.
  • The main process forwards only recognized browser-backward / browser-forward app commands to an existing renderer navigation channel.
  • The renderer hook prevents default browser side-button behavior only for unmodified Mouse4/Mouse5 gestures.

ELI5

Mouse side buttons (back/forward) switch to the previous or next visible tab. Works both from renderer mouse events and Electron’s app-command path.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two tab-navigation paths are added. In the main process, browser-backward and browser-forward app-command values are mapped to -1 and 1, and the supported commands prevent default handling before sending ui:switchTabAcrossAllTypes to the renderer. In the renderer, useMouseTabNavigation installs global capture-phase mouse listeners for side buttons, prevents default for matching events, and calls handleSwitchTabAcrossAllTypes; App now invokes the hook. New tests cover both paths and their cleanup behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature change in the PR.
Linked Issues check ✅ Passed The PR implements Mouse4/Mouse5 tab navigation in both renderer and Electron app-command paths requested by #6658.
Out of Scope Changes check ✅ Passed The changes stay focused on side-button tab navigation and regression tests, with no unrelated feature or behavior changes.
Description check ✅ Passed The PR description covers summary, screenshots, testing, AI review, and security audit, with only the optional Notes section omitted.

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.

🧹 Nitpick comments (2)
src/main/window/createMainWindow.ts (1)

324-330: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing “Why” on the app-command bridge.

Forwarding browser-backward / browser-forward into ui:switchTabAcrossAllTypes is not obvious from the code alone. A short note here that this exists because Electron can surface side-button input as app-command events would match the rest of this file and make the main/renderer split easier to preserve.

As per coding guidelines, **/*.{ts,tsx,js,jsx}: When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.

Source: Coding guidelines

src/renderer/src/hooks/useMouseTabNavigation.ts (1)

21-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a short “Why” comment above these global capture listeners.

Using capture-phase mousedown / mouseup / auxclick handlers and swallowing defaults is non-obvious. Please document the reason here so this doesn’t get “simplified” later.

As per coding guidelines, **/*.{ts,tsx,js,jsx}: When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 26a0adba-f5f1-4647-bb0f-00a2c4dc65c5

📥 Commits

Reviewing files that changed from the base of the PR and between 7c6f88b and 9fefcc7a91e29406b64e8c46c1f87fd371fe5c83.

📒 Files selected for processing (5)
  • src/main/window/createMainWindow.test.ts
  • src/main/window/createMainWindow.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/hooks/useMouseTabNavigation.test.tsx
  • src/renderer/src/hooks/useMouseTabNavigation.ts

@AmethystLiang
AmethystLiang requested a review from Jinwoo-H June 29, 2026 16:48
@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:43
@sdhilip200
sdhilip200 force-pushed the codex/mouse-side-button-navigation branch from 030fcff to d0fd343 Compare July 26, 2026 20:30
@sdhilip200

Copy link
Copy Markdown
Contributor Author

Rebased onto current \ and resolved the conflict in \ by keeping the newer traffic-light positioning comment and retaining the mouse side-button tab-switch helper from this PR. Force-pushed the updated branch. I couldn’t run the targeted Vitest/typecheck commands in this worktree because the checkout here does not have installed Node dependencies.

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Mouse4/Mouse5 forward/back button navigation support

4 participants