Skip to content

MacOS: Navigate Workspaces & Browser using back/forward swipe gestures - #25592

Closed
AlexThunder1989 wants to merge 1 commit into
stablyai:mainfrom
AlexThunder1989:macos-swipe-navigation
Closed

AlexThunder1989 wants to merge 1 commit into
stablyai:mainfrom
AlexThunder1989:macos-swipe-navigation

Conversation

@AlexThunder1989

@AlexThunder1989 AlexThunder1989 commented Oct 5, 2026 •

Copy link
Copy Markdown

On macOS, the back/forward swipe now navigates like the mouse side buttons in #25555: back/forward in the web page under the pointer, otherwise back/forward through workspaces. It covers trackpad page swipes and Logitech Options+ back/forward buttons, which macOS sends as the same gesture.

#25555 is minimal for Linux and Windows and does the job well. macOS is more or less standalone: a swipe arrives without a target, like a key press, so this PR wraps it into the same back/forward navigation and checks what's under the pointer.

Input Arrives in Orca as Handled by
Side buttons on Linux / Windows Mouse button 3 / 4 #25555
Side buttons on macOS, mouse without vendor software Mouse button 3 / 4 #25555
Logitech Options+ back/forward on macOS Swipe between pages #25592
Trackpad page swipe on macOS Swipe between pages #25592
Pointer over Mouse buttons (#25555) Swipe (#25592)
A web page Page back/forward Page back/forward
A remote (streamed) web page Remote page back/forward Remote page back/forward (with #25555)
Anywhere else Workspace back/forward Workspace back/forward

Both PRs use the existing workspace history (⌘⌥←/→, Ctrl+Alt+←/→), share no code, and can merge in either order.

EDIT: Swipes over a remote web page now go back/forward in that page (with #25555), and the swipe is now decided in the window instead of the main process (8862fd9).

ELI5

On a Mac, swipe back/forward (or press the Logitech back/forward buttons) to go to the previous or next workspace, or page when over a web page.

What Changed

The main process forwards the swipe as a ui:swipeNavigate message. The window sends it to the web page under the pointer, to a remote page (as the side-button click that page already handles), or to workspace history.

Why

A swipe isn't a mouse click, so #25555 never sees it.

Linked Issue

Fixes #25633 (macOS part)

Related: #25555, #23255

Visual Proof

N/A — no UI change.

Testing

  • I manually tested these changes locally (macOS 26, MX Master 3S / MX Anywhere 3 with Logi Options+, three-finger trackpad swipe); local web page, workspace switching, and a remote web page from macOS to a Linux host (with Navigate workspace history with the mouse side buttons #25555)
  • Automated tests added/updated, or explained why not below

Transport test added (swipe → ui:swipeNavigate); the pointer-based mapping is UX and was tested manually.

AI Disclosure

Claude Opus 5.5 (Claude Code).

Review

N/A

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

N/A — macOS-only window event; no SSH, mobile, security, performance or compatibility impact.

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)

@AlexThunder1989 AlexThunder1989 changed the title Navigate on macOS back/forward swipe gestures MacOS: Navigate Workspaces & Browser using back/forward swipe gestures Oct 5, 2026

@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.

ℹ️ One browser-pane gap inline, plus a note on test coverage.

Reviewed changes

  • macOS swipe listener — createMainWindow.ts now binds the window swipe event and maps left/right to back/forward.
  • Hovered-guest routing — resolves the <webview> under the pointer via executeJavaScript and drives guest.navigationHistory.goToOffset(), otherwise forwards ui:worktreeHistoryNavigate.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/window/createMainWindow.ts Resolved

@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 in the incremental change.

Reviewed changes (incremental)

  • Comment reword only — the Why: comment above the hover lookup now reads "moves to another workspace" (createMainWindow.ts:151). No behavioral change; the inline browser-pane gap from the prior review still applies.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Oct 5, 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

createMainWindow sends back or forward navigation events for left and right swipes. The preload API exposes a subscription for those events. The renderer bridge navigates a hovered webview, dispatches a pointer event to a hovered remote browser frame, or navigates worktrees when neither is hovered and the active view is terminal.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: 🟡 Moderate · up to 8862f

Swipes over remote browser pages do nothing. Fix remote-page history navigation before merging unless that limitation is explicitly accepted.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 8862f

Swipe navigation reuses existing page and workspace permissions rather than granting new access. Remote-page swipes currently have no effect at this revision, and some downstream recovery behavior remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated scope is the current application window's hovered guest page or existing workspace-history targets. Workspace history can cross repositories and invoke normal session activation. At this head, the remote-frame branch does not transmit input to a remote runtime.

Trust Boundaries and Controls

  • observed — The new subscription receives a native main-window event rather than exposing a command to trigger privileged navigation. Actual webview guest protection comes from existing attachment controls: registry-based admission, replacement of renderer-supplied preload, disabled Node integration, enabled context isolation and sandboxing. The web UI no-op API is a separate compatibility measure, not the guest isolation boundary.

Resilience and Maintainability Implications

  • inferred — The concrete history activator returns synchronously, resolving the suspected promise-versus-history-index mismatch. Asynchronous wake and restoration side effects remain separate from that selection commit. These mechanisms predate the PR and are already reachable through keyboard history navigation; the inspected evidence does not establish a newly weakened recovery guarantee.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue [#25633] requires back/forward over any non-web-page area to navigate workspace history. In swipe-navigation-ipc-bridge.ts, the handler returns when activeView !== 'terminal', so a swipe out… Allow non-browser swipes to navigate workspace history regardless of activeView, while keeping the browser-page routing behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The main-process event forwarding, preload bridge, renderer routing, and transport test all support the macOS swipe behavior requested by [#25633]. The test harness change supports that test. No unrel…
Title check ✅ Passed The title clearly and concisely describes the macOS swipe navigation change for workspaces and browser history.
Description check ✅ Passed The description explains the user-facing behavior, implementation, rationale, linked issue, and reported testing. The Visual Proof section says N/A because there is no UI change, but the template also…
Full details: Linked Issues check

Explanation

Issue [#25633] requires back/forward over any non-web-page area to navigate workspace history. In swipe-navigation-ipc-bridge.ts, the handler returns when activeView !== 'terminal', so a swipe outside a hovered browser page does nothing in other active views.

  • Fix all pre-merge checks with AI
  • Autopilot · 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

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b697e629-b06b-46c8-ac05-f57fd10bddaa
📥 Commits

Reviewing files that changed from the base of the PR and between d173514 and 59e4c9d5b3a0f8f4044706fe805ef5b98e154077.

📒 Files selected for processing (1)
  • src/main/window/createMainWindow.ts

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

Comment thread src/main/window/createMainWindow.ts Resolved
@AlexThunder1989
AlexThunder1989 force-pushed the macos-swipe-navigation branch 2 times, most recently from 51d4b65 to d87b155 Compare October 5, 2026 14:38

@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 (since the prior pullfrog review)

  • Remote/streamed browser pane detection — the hover probe now returns a -1 sentinel when the pointer is over [data-testid="remote-browser-frame"], since those panes render a screencast <img> rather than a <webview>.
  • No-op instead of workspace switch — the else branch became else if (guestId !== -1), so a swipe over a remote pane does nothing instead of navigating workspace history.
  • PR description updated — it now states that a swipe over a remote tab does nothing, aligning the code and the description with the resolution the prior review asked for.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@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 (since the prior pullfrog review)

  • Probe failure now ignores the swipe — the hover probe's .catch resolves to the -1 sentinel instead of undefined, so when executeJavaScript rejects (e.g. getWebContentsId() on a <webview> that is still attaching) the swipe is ignored rather than forwarded to ui:worktreeHistoryNavigate.
  • Comment updated — the Why: line above the lookup now notes that -1 also covers a guest still attaching.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@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 critical issues — the new tests are sound; one small coverage gap inline.

Reviewed changes

  • Swipe navigation tests added — createMainWindow-swipe-navigation.test.ts drives the window swipe handler with a mocked BrowserWindow, asserting workspace back/forward routing, hovered-<webview> paging, and the three ignore cases (remote frame, still-attaching guest, vertical swipe).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@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

  • Test commit dropped — the branch now points at 2d06866, so createMainWindow-swipe-navigation.test.ts is gone and the swipe handler is unchanged from the version already reviewed earlier on this PR.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@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
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99adc512-a694-42d5-a3c7-36266ca72ca0
📥 Commits

Reviewing files that changed from the base of the PR and between 2d06866f7f59c0b8ec61b7d80bef4cedf07f49db and 8862fd9.

📒 Files selected for processing (8)
  • src/main/window/createMainWindow-swipe-navigation.test.ts
  • src/main/window/createMainWindow-test-harness.ts
  • src/main/window/createMainWindow.ts
  • src/preload/api/ui-bridge-state-and-menu-commands.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/hooks/ipc-events/app-lifetime-ipc-bridge.ts
  • src/renderer/src/hooks/ipc-events/swipe-navigation-ipc-bridge.ts
  • src/renderer/src/web/preload-api/web-ui-api.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.

Comment on lines +16 to +24
return
}
const remoteFrame = document.querySelector('[data-testid="remote-browser-frame"]:hover')
if (remoteFrame) {
// Why: wrap the swipe as the side-button click the remote pane already turns into remote back/forward.
remoteFrame.dispatchEvent(
new PointerEvent('pointerdown', { bubbles: true, button: direction === 'back' ? 3 : 4 })
)
return

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 | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,45p' src/renderer/src/hooks/ipc-events/swipe-navigation-ipc-bridge.ts
rg -n 'button === [34]|button: [34]|pointerdown|mousedown|remote-browser-frame' src/renderer/src/components/browser-pane | head -110

Repository: stablyai/orca

Length of output: 3199


🏁 Script executed:

rg -n -i 'remote.?browser|button\s*={1,2}\s*[34]|button:\s*[34]|pointerdown|pointerup|mousedown|auxclick|goBack|goForward|navigate.*(back|forward)|back.*forward' src/renderer/src/components/browser-pane/stream-remote src/renderer/src

Repository: stablyai/orca

Length of output: 45661


🏁 Script executed:

rg -n 'handleRemotePointerDown|onPointerDown|event\.button|button\s*===|getRemoteBrowserMouseButton|remoteBrowserPage.*(back|forward)|navigate.*(back|forward)' src/renderer/src/components/browser-pane/stream-remote
printf '\n--- input hook ---\n'
sed -n '1,260p' src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-input.ts
printf '\n--- viewport ---\n'
sed -n '1,190p' src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-viewport.tsx
printf '\n--- mouse model ---\n'
sed -n '1,125p' src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts

Repository: stablyai/orca

Length of output: 24946


🏁 Script executed:

nl -ba src/renderer/src/hooks/ipc-events/swipe-navigation-ipc-bridge.ts
printf '\n--- registration references ---\n'
rg -n -F 'registerSwipeNavigationIpcBridge' src/renderer/src
printf '\n--- receiver and mapper ---\n'
nl -ba src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-input.ts | sed -n '128,205p'
nl -ba src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts | sed -n '76,92p'
nl -ba src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.test.ts | sed -n '10,22p'
nl -ba src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-viewport.tsx | sed -n '98,114p'
printf '\n--- explicit swipe/delegation references ---\n'
rg -n -i 'swipe.?navigation|side.?button|button.?3|delegat.{0,40}(pr|pull request)|another pr' src/renderer/src/components/browser-pane/stream-remote src/renderer/src/hooks/ipc-events

Repository: stablyai/orca

Length of output: 7926


Handle remote history swipes before filtering mouse buttons.

When a remote frame is hovered, the swipe bridge dispatches a bubbling pointerdown with button 3 or 4 to the frame. The frame’s handler maps those buttons to null and returns without navigating history or sending remote input. Remote-page swipes therefore do nothing.

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue (#25633) has been resolved on main by #31859 (1b0e56e385). Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
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

2 participants