Skip to content

fix(desktop): route mouse thumb buttons to the in-app browser - #4459

Merged
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
akosbalogh:fix/preview-mouse-thumb-navigation
Aug 15, 2026
Merged

fix(desktop): route mouse thumb buttons to the in-app browser#4459
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
akosbalogh:fix/preview-mouse-thumb-navigation

Conversation

@akosbalogh

@akosbalogh akosbalogh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #4839

What changed

Mouse thumb (side) buttons — back = button 3, forward = button 4 — now navigate the in-app browser's history when the pointer is over the preview <webview>, instead of navigating the host T3 Code app (threads/agents view).

Why

The preview is an Electron <webview> whose WebContents is driven by PreviewManager. When the pointer merely hovers the guest page (the guest isn't focused), Chromium routes thumb-button history navigation to the focused WebContents — the host app renderer — so pressing back/forward over the browser sent the app router back instead of the browser. This was intermittent ("sometimes") because it depended on which surface held focus.

Note app-command is Windows/Linux-only and Electron never auto-navigates on it, and this repo has no handler — so that path is deliberately untouched. The DOM-level path is the mechanism here.

How

  • PickPreload.ts (runs inside every preview guest): capture-phase listeners for the thumb buttons preventDefault() + stopImmediatePropagation() on mousedown/mouseup/auxclick to suppress Chromium's default navigation, and forward an explicit { direction } over a new MOUSE_NAVIGATE_CHANNEL IPC. Guarded by event.isTrusted so automation-injected events are unaffected.
  • Manager.ts: attachListeners registers a mouseNavigate handler that drives that tab's history via the existing wc.navigationHistory.goBack()/goForward() (guarded by canGoBack()/canGoForward()), mirroring the existing UI back/forward path. Registered/torn down alongside the existing HUMAN_INPUT_CHANNEL listener.
  • GuestProtocol.ts: new MOUSE_NAVIGATE_CHANNEL constant.

Suppression in the guest is unconditional, so the host app never navigates while the cursor is over the browser — even when the browser has no back history.

Testing

  • New unit test in Manager.test.ts asserting the IPC handler drives goBack/goForward, ignores unknown payloads, and does nothing when history is exhausted.
  • Manually exercised on macOS against a dev build: with the main-process handler instrumented, the guest was confirmed to receive and forward both directions with the correct tab id, and the preview navigated its own history.
  • apps/desktop typecheck, lint, format pass locally. Repo-wide vp check reports 0 errors and the desktop suite passes 368/368 — worth noting since CI on this PR is still sitting at action_required pending maintainer approval, so none of it has run here.

🤖 Generated with Claude Code


Note

Low Risk
Localized preview input/navigation wiring with validation and history guards; no auth, data, or broad architectural changes.

Overview
Mouse thumb buttons (back / forward) over the preview webview now move that tab’s browser history instead of the host app router when the guest isn’t focused.

PickPreload intercepts trusted thumb-button events in capture phase, blocks Chromium’s default routing, and sends { direction } on preview:mouse-navigate. PreviewManager handles that IPC like existing guest channels and calls navigationHistory.goBack() / goForward() only when canGoBack / canGoForward allow it.

A unit test covers back/forward, invalid payloads, and no-op when history is exhausted.

Reviewed by Cursor Bugbot for commit deb168a. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0dc2f95d-435f-40a2-8825-4f0f8fbd0cc2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 24, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This is a targeted bug fix for mouse thumb button navigation in the in-app browser. The changes follow existing patterns in the codebase, include comprehensive tests, and are self-contained within the preview system without touching sensitive areas.

You can customize Macroscope's approvability policy. Learn more.

When the pointer hovers the preview <webview> without focusing it,
Chromium routes back/forward thumb-button navigation to the focused
host renderer, so the app router navigated instead of the browser.

Intercept the thumb buttons (button 3 = back, 4 = forward) in the guest
preload, suppress Chromium's default, and forward an explicit navigate
request to PreviewManager so the buttons always drive the hovered
browser's history and never the host app.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the fix/preview-mouse-thumb-navigation branch from d04de2b to deb168a Compare August 15, 2026 12:05
@juliusmarminge
juliusmarminge merged commit 7c8848e into pingdotgg:main Aug 15, 2026
14 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 15, 2026
## What's Changed
* fix(desktop): route mouse thumb buttons to the in-app browser by @akosbalogh in pingdotgg/t3code#4459
* fix(web): keep the final segment of directory paths with a trailing separator by @jorvarea in pingdotgg/t3code#5460
* Keep block code plain when copying from rendered markdown by @yashranaway in pingdotgg/t3code#4468
* fix(web): add web app manifest so installed app keeps its scope by @Albro3459 in pingdotgg/t3code#4306
* Skip user hooks during Claude capability probes by @yashranaway in pingdotgg/t3code#4466
* fix(mobile): use Android monospace font family by @tastelessjolt in pingdotgg/t3code#4609
* fix(desktop): timestamps follow the OS locale instead of en-US by @brzzdev in pingdotgg/t3code#6190
* fix(web): keep multi-select questions open after the first click by @RaitP1 in pingdotgg/t3code#6646
* fix(web): stop clipping the changed-files expand hover on Windows by @mrmg in pingdotgg/t3code#6545
* fix(server): allow long-running git pushes by @devchaudhary24k in pingdotgg/t3code#6499
* fix(desktop): keep probing backend readiness while the process is alive by @lgwacker in pingdotgg/t3code#5526
* fix(server): allow install scripts in npm-global provider updates by @hey-jj in pingdotgg/t3code#5646
* fix: detect SSH remotes with non-git user prefixes (e.g. gitlab@) by @JackatDJL in pingdotgg/t3code#3649
* fix(web): describe what Ultracode does in the Reasoning picker by @delltrak in pingdotgg/t3code#6092
* fix(server): settle pending user-input requests when a Claude session stops by @AaronAbuUsama in pingdotgg/t3code#5127
* fix(server): stop replaying a command receipt for a different aggregate by @ostapondo in pingdotgg/t3code#5246
* fix(server): settle snoozed threads immediately by @0bkevin in pingdotgg/t3code#5379
* fix(mobile): prevent crash on sign out in settings by @shubhu121 in pingdotgg/t3code#4899
* fix(mobile): local-checkout threads record their branch so PR badges show by @Zeus-Deus in pingdotgg/t3code#4986
* fix(web): contain long approval commands by @Serendeep in pingdotgg/t3code#6503
* feat(web): make right panel maximize bindable by @husseinraoouf in pingdotgg/t3code#5091
* fix(server): respect inherited OPENCODE_CONFIG_CONTENT by @jonocodes in pingdotgg/t3code#4242
* fix(marketing): detect Mac chip on homepage download button by @mahdibm-dev in pingdotgg/t3code#4197
* Keep the server alive when a response write hits a dead socket by @yashranaway in pingdotgg/t3code#4470
* Limit physical key fallback to non-Latin layout output by @yashranaway in pingdotgg/t3code#4469
* fix: restore CLAUDE.md symlink target by @NgoQuocViet2001 in pingdotgg/t3code#3929
* fix(clients): default clone destination to folder plus repo name by @inayayousfi in pingdotgg/t3code#5989
* fix(web): keep timestamp date and time in the same locale by @juliusmarminge in pingdotgg/t3code#7081
* feat(desktop): add signal macOS DMG installer background by @Brechard in pingdotgg/t3code#6201

## New Contributors
* @akosbalogh made their first contribution in pingdotgg/t3code#4459
* @jorvarea made their first contribution in pingdotgg/t3code#5460
* @yashranaway made their first contribution in pingdotgg/t3code#4468
* @Albro3459 made their first contribution in pingdotgg/t3code#4306
* @tastelessjolt made their first contribution in pingdotgg/t3code#4609
* @brzzdev made their first contribution in pingdotgg/t3code#6190
* @RaitP1 made their first contribution in pingdotgg/t3code#6646
* @devchaudhary24k made their first contribution in pingdotgg/t3code#6499
* @lgwacker made their first contribution in pingdotgg/t3code#5526
* @JackatDJL made their first contribution in pingdotgg/t3code#3649
* @delltrak made their first contribution in pingdotgg/t3code#6092
* @AaronAbuUsama made their first contribution in pingdotgg/t3code#5127
* @0bkevin made their first contribution in pingdotgg/t3code#5379
* @shubhu121 made their first contribution in pingdotgg/t3code#4899
* @Zeus-Deus made their first contribution in pingdotgg/t3code#4986
* @husseinraoouf made their first contribution in pingdotgg/t3code#5091
* @jonocodes made their first contribution in pingdotgg/t3code#4242
* @mahdibm-dev made their first contribution in pingdotgg/t3code#4197
* @NgoQuocViet2001 made their first contribution in pingdotgg/t3code#3929
* @inayayousfi made their first contribution in pingdotgg/t3code#5989

**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260815.1101...v0.0.34-nightly.20260815.1102

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260815.1102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mouse thumb (back/forward) buttons navigate the app instead of the in-app browser when the cursor is over the preview

2 participants