Skip to content

Step workspace history with the mouse Back/Forward buttons outside pages - #34463

Open
AlexThunder1989 wants to merge 4 commits into
stablyai:mainfrom
AlexThunder1989:mouse-side-buttons-workspace-history
Open

AlexThunder1989 wants to merge 4 commits into
stablyai:mainfrom
AlexThunder1989:mouse-side-buttons-workspace-history

Conversation

@AlexThunder1989

@AlexThunder1989 AlexThunder1989 commented Oct 27, 2026 •

Copy link
Copy Markdown

ELI5

The mouse Back/Forward side buttons now do what the title-bar ← → arrows do when the pointer is over Orca itself (sidebar, terminal, editor): step back or forward through the workspaces you visited. Over a web page they keep going back and forward in that page, as #31859 made them do.

What Changed

Pointer is over Before After
Orca's own UI, on any view that shows ← → (terminal, Tasks, Automations, Artifacts, Skills) Nothing One step through workspace history, same as ← → and Mod+Alt+←/→
Settings and other views without the ← → arrows Nothing Nothing
A local or streamed browser page That page's history (#31859) Unchanged

Mechanism, one file: app-commands/workspace-shortcut-ipc-bridge.ts already handles onWorktreeHistoryNavigate. Its handler becomes a named function, and a bubble-phase window mouseup listener calls it for buttons 3 and 4.

  • Bubble phase plus defaultPrevented: a streamed page's viewport claims its side-button presses with preventDefault first (use-remote-browser-page-pointer-history.ts), so those never also switch workspace. Local <webview> pages never reach the host document.
  • The listener calls preventDefault on views that show the ← → arrows, so in the paired web client the outer browser does not also go back; on views without the arrows (Settings) the browser keeps its own Back. At either end of history the press is still claimed; see the review thread.
  • The gate is canNavigateWorktreeHistory, the rule that shows the ← → arrows, so the buttons work wherever the arrows do and views without them stay inert. The existing handler only allowed the terminal view, so Mod+Alt+←/→ from the main process now also works on Tasks, Automations, Artifacts and Skills, as the arrows already did (found by @syjeon121).

Why

#31859 fixed side buttons over pages and left the rest of Orca out of scope. Mouse Back/Forward over the app still does nothing, while the same history is one shortcut away. This is the smallest change that gives the buttons the arrows' behaviour by default, with no setting or binding. If the scope decision in #31859 stands, closing this is fine.

Linked Issue

Fixes #25633 (closed by #31859, which delivered the page part; this is the workspace part of the same request).

Visual Proof

N/A: input-only change with no new UI.

Testing

  • Manually tested: @syjeon121 on Windows 11 with a real mouse (sidebar, terminal with a mouse-mode TUI, editor, browser page, Settings); see the comment below.

  • Automated tests added/updated, or explained why not below

  • Unit: workspace-shortcut-ipc-bridge.side-buttons.test.ts covers buttons 3/4, a page view that shows the arrows (Tasks), other buttons and views, and a press already claimed by a streamed page. The first case fails without the change.

  • No e2e case: the back/forward e2e suite this PR extended was removed from main in test: remove low-value UI, shell, relay and build-tool checks #43138.

  • Typecheck (web project), oxlint and oxfmt pass locally on current main.

  • Linux, built app on current main: X buttons 8/9 (the side buttons) over the sidebar, a terminal with mouse reporting on, the editor, Tasks, Settings and a browser page, and between a local workspace and one on a Remote Orca Server. Each press steps once, the terminal receives nothing, Settings does nothing, and over the page only the page navigates.

  • Windows 11 with a real mouse, by @syjeon121.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@alex-menielle

alex-menielle commented Nov 23, 2026 •

Copy link
Copy Markdown

+1 from Windows 11 on Orca 1.4.271: the side buttons still do nothing outside browser pages. #25633 was closed when #31859 merged, but that only covered web pages. This PR is the missing part, would love to see it land.

The bridge gated on activeView === 'terminal', but the title-bar arrows also
show on Tasks, Automations, Artifacts and Skills, whose pages are history
entries. Side buttons (and main-process history shortcuts) did nothing there
while the arrows worked. Gate on shouldShowWorktreeHistoryControls instead,
the rule the arrows and the renderer keybinding path already use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@syjeon121

Copy link
Copy Markdown

Tested this on Windows 11 with a real mouse (physical side buttons, not CDP), on this branch rebased onto current main (300a4d36991).

Works as described

  • Over the sidebar, terminal (including a TUI with mouse mode on), and editor: Back/Forward step one workspace at a time, the same as the title-bar arrows. No double steps.
  • Over a browser page: only that page goes back/forward. The workspace doesn't change.
  • Settings: nothing happens (no arrows there, as intended).

One gap: pages that show the arrows

On the Tasks page (and Automations, Artifacts, Skills, which are history entries too), the title-bar ← works but mouse Back does nothing. navigateWorktreeHistory still requires activeView === 'terminal'. Using shouldShowWorktreeHistoryControls(store.activeView) instead, the rule that decides when the arrows show, fixes it. I sent that as AlexThunder1989#2 against your branch: one line plus one test case.

Conflicts with main

The PR currently conflicts:

  • refactor(renderer): group hooks and IPC events by feature #43575 moved src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts to src/renderer/src/hooks/app-commands/. The handler there now also checks canNavigateWorktreeHistory(store) and wraps the calls in runBuiltInOrReplacement('worktree.history.back' | 'worktree.history.forward', …). I kept both inside the extracted navigateWorktreeHistory, and the unit test passes after moving it next to the bridge.
  • tests/e2e/workspace-back-forward-navigation.spec.ts was deleted on main (test: remove low-value UI, shell, relay and build-tool checks #43138), so the new e2e case needs a new home or can be dropped.

Thanks for picking this up! It's exactly the part that was missing after #31859.

…rkspace-history

# Conflicts:
#	src/renderer/src/hooks/app-commands/workspace-shortcut-ipc-bridge.ts
#	tests/e2e/workspace-back-forward-navigation.spec.ts
@AlexThunder1989

Copy link
Copy Markdown
Author

Thanks @syjeon121, both points taken:

  • Step history with side buttons on every view that shows the arrows AlexThunder1989/orca#2 is in (your commit, unchanged).
  • Merged current main. The handler now lives in hooks/app-commands/, keeps runBuiltInOrReplacement, and gates on canNavigateWorktreeHistory alone. That already includes shouldShowWorktreeHistoryControls, so your fix carries over as dropping the activeView !== 'terminal' clause. The unit test moved next to the bridge (4 pass), and the e2e case went with the suite test: remove low-value UI, shell, relay and build-tool checks #43138 removed.
  • One more commit: the listener now cancels the browser's own Back only when it actually steps history, so on views without the arrows (Settings, or the paired web client) the browser keeps its Back. Tested in the built Linux app as well: sidebar, a terminal with mouse reporting on, the editor, Tasks, Settings, a browser page, and between a local and a Remote Orca Server workspace.

@AlexThunder1989
AlexThunder1989 marked this pull request as ready for review November 24, 2026 18:55
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The workspace shortcut IPC bridge now uses a shared helper to check worktree history eligibility and dispatch backward or forward navigation. It also handles unprevented mouseup events for buttons 3 and 4, and prevents the event’s default only when navigation succeeds. Tests cover navigation in terminal and tasks views, ignored buttons and views, and events already prevented by another handler.

Severity of issue fixed: Low

Merge Risk: Low · up to 0f9e6

Mouse Back/Forward buttons now step workspace history outside browser pages. When there is no history left to step, the press is still consumed rather than left to the browser. This is a small edge-case gap that is easy to fix before or shortly after merge.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description is thorough and covers nearly every required section. The ELI5 section explains the change in plain language, and the What Changed section gives a before/after table plus the mechanism… 1) Complete the Performance line. Finish the sentence, for example: 'None, because this only runs on a mouseup event for buttons 3 and 4 and only when the pointer is over a view that shows the ← → arrows.' 2) Add a Risk section. State the r…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: mouse Back/Forward side buttons step workspace history when the pointer is over Orca UI outside web pages. The raw summary and objectives confirm the bridge's mouseup …
Linked Issues check Passed The only linked issue, #25633, is closed and marked as historical context only. Per the assessment rules, no active directly linked targets remain, so no linked-issue coding requirements apply. The PR…
Out of Scope Changes check Passed The changes stay within the stated mouse side-button scope. The bridge change adds the window mouseup listener for buttons 3 and 4 and extracts the worktree-history handler into navigateWorktreeHistor…
Full details: Title check

Explanation

The title names the main change: mouse Back/Forward side buttons step workspace history when the pointer is over Orca UI outside web pages. The raw summary and objectives confirm the bridge's mouseup listener for buttons 3 and 4 and the canNavigateWorktreeHistory gate. At 72 characters it is slightly long, but it is specific and accurate.

Full details: Linked Issues check

Explanation

The only linked issue, #25633, is closed and marked as historical context only. Per the assessment rules, no active directly linked targets remain, so no linked-issue coding requirements apply. The PR states its scope as the workspace part of #25633 after #31859 delivered page navigation. This assessment does not treat #25633 acceptance criteria, including the macOS swipe request, as PR objectives. Reviewed head 0f9e608: src/renderer/src/hooks/app-commands/workspace-shortcut-ipc-bridge.ts registers a window bubble-phase mouseup listener for buttons 3 and 4. It skips defaultPrevented events, gates on canNavigateWorktreeHistory, and calls preventDefault only when navigation succeeds. The side-button unit test exists at the head. The whole-PR diff read failed because changed blobs were unavailable, so base-to-head comparison relies on the supplied summary and the head file content.

Full details: Out of Scope Changes check

Explanation

The changes stay within the stated mouse side-button scope. The bridge change adds the window mouseup listener for buttons 3 and 4 and extracts the worktree-history handler into navigateWorktreeHistory, which is used by both the IPC handler and the mouse listener. The removal of the terminal-only check from the IPC path also changes main-process Mod+Alt+←/→ behavior on Tasks, Automations, Artifacts, and Skills. This is a disclosed consequence of reusing the arrow-visibility gate, and the PR objectives describe it explicitly. It is not unrelated work. The unit test file covers the same behavior. The move into hooks/app-commands/ and the retained runBuiltInOrReplacement wrapping are described as conflict resolution and do not add unrelated logic in the reviewed head. Limitation: base-side content could not be read, so removed lines were not independently verified.

Full details: Description check

Explanation

The description is thorough and covers nearly every required section. The ELI5 section explains the change in plain language, and the What Changed section gives a before/after table plus the mechanism (bubble-phase mouseup listener in workspace-shortcut-ipc-bridge.ts, defaultPrevented handling, and the canNavigateWorktreeHistory gate). The Why section explains the alternatives and scope. The Linked Issue section cites #25633. Visual Proof is N/A with a reason. Testing lists manual tests on Linux and Windows 11 and names the unit test file. Performance is a one-line answer that is incomplete: it reads 'None, because' and the reason is not finished. The Risk section is missing entirely, including the Level field and the rollback plan. The AI Disclosure section is empty. The Review section is empty. The final pnpm checklist item is unchecked, and the PR states that lint and typecheck were run only on the web project. The description is mostly complete, but the missing Risk section and the unfinished Performance sentence keep it from a clear pass.

Resolution

  1. Complete the Performance line. Finish the sentence, for example: 'None, because this only runs on a mouseup event for buttons 3 and 4 and only when the pointer is over a view that shows the ← → arrows.' 2) Add a Risk section. State the riskiest part (the preventDefault call on views with arrows, which can block the browser's own Back in the paired web client, and the claim of presses at the end of history). State who is affected, and state the rollback method (a plain revert of the bridge file and its test). Set Level: to Low, Medium, or High. 3) Fill in the AI Disclosure section, or state that no AI model was used. 4) Fill in or remove the empty Review section. 5) Run pnpm lint, pnpm typecheck, pnpm test, and pnpm build, then check the last checklist item, or state which steps CI will cover. 6) Confirm the 'Automated tests added/updated' box checks the anti-pattern item (the final Testing checkbox) or explain why it is unchecked.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@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: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5938a620-5a8d-48cf-9d31-3a7e30e10b83
Commits

Reviewing files that changed from the base of the PR and between 3937da7 and 0f9e608.

Files selected for processing: 2

  • src/renderer/src/hooks/app-commands/workspace-shortcut-ipc-bridge.side-buttons.test.ts
  • src/renderer/src/hooks/app-commands/workspace-shortcut-ipc-bridge.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.

} else {
runBuiltInOrReplacement('worktree.history.forward', () => store.goForwardWorktree())
}
return true

@coderabbitai coderabbitai Bot Nov 24, 2026 •

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.

Minor · Functional Correctness · Quick win

Cancel the side-button default only when workspace history moves.

navigateWorktreeHistory returns true when canNavigateWorktreeHistory passes. That check reads only activeModal and activeView, not history bounds. At the back boundary, navigateToIndex returns before it changes the index, but the bridge still returns true. onMouseSideButton then calls preventDefault(). The same happens at the forward boundary and when the activator returns false. The browser default is cancelled with no workspace movement. This contradicts the PR's stated intent to call preventDefault only when workspace history changes.

Return movement from the store. Have navigateToIndex report whether the index changed, and have goBackWorktree and goForwardWorktree return that value. Cancel the default only on movement. The replacement path cannot report movement, because runBuiltInOrReplacement returns void and settles asynchronously. Define the required default behavior for replacement commands before changing that path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Right: navigateToIndex returns early at either end of history, so at a boundary the press is still claimed. I've reworded the description to match: the listener claims a press on views that show the ← → arrows.

In the desktop app that changes nothing visible, since there is nowhere to go either way. In the paired web client it means mouse Back at the very start of history doesn't take the browser tab back. Claiming only on real movement would need goBackWorktree/goForwardWorktree to report it, and a plugin replacement through runBuiltInOrReplacement settles later and can't report it at all. That's a design call for maintainers, so I'm keeping this PR to the listener.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Mouse back/forward buttons and macOS swipe should navigate workspaces and browser pages

3 participants