[Bug]: Mouse Back/Forward over the right panel (outside browser page content) navigates the main chat instead of the panel#30854

opened7d agobySspnotold

Note

๐Ÿค– Claude Opus 5.5 writing on behalf of spnotold

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread, then open the right panel with a Browser tab. Follow a few links so the tab has back history.
  2. Put the pointer over the panel but not over the page content: the tab strip, the browser toolbar/address bar, or any non-browser tab such as a side chat.
  3. Press the mouse thumb Back button.

Expected behavior

While the pointer is anywhere over the right panel, the thumb Back/Forward buttons act on the panel and never on the main chat:

  • Browser tab active: go back/forward in that tab's history. This should work over the toolbar, address bar and tab strip too, not only over the page.
  • Side chat or another tab active: navigate within the panel. A simple option is a panel-scoped history of which surface was active, e.g. browser โ†’ side chat โ†’ diff. If that's out of scope, the press should at least do nothing instead of moving the main thread.

When the pointer is over the main chat area, the current behavior (app router back/forward between threads) should stay as it is.

Actual behavior

The main app router navigates (the main chat switches to the previously viewed thread), and the panel doesn't change. I use the browser in the right panel all the time, so I keep losing my place in the main chat.

Impact

Major degradation or frequent failure

Version or commit

Server 0.1.8-nightly.20261104.4165. Source references below are from main @ 8b44f42b14.

Environment

macOS T3 Code desktop client connected to a Linux server environment.

Notes from the source

#4839 (fixed by #4459) and #22516 fixed this only while the pointer is over the page content:

  • Native webview: guest preload apps/desktop/src/preview/PickPreload.ts handles buttons 3/4 โ†’ Manager.mouseNavigate.
  • Server-streamed tab: apps/web/src/browser/ServerBrowserSurface.tsx historyDeltaOf / handleMouseUp is attached only to the page-content element (onMouseUp ~L747).

Everything else in the panel falls through to Chromium's default, which runs history back/forward on the host document and moves the app router:

  • apps/web/src/components/preview/PreviewChromeRow.tsx has onBack/onForward buttons but no thumb-button handling.
  • apps/web/src/components/RightPanelTabs.tsx handles middle-click (onAuxClick, preventTabMiddleButtonDefault) but not buttons 3/4.
  • Non-browser surfaces (side-chat, diff, files, terminal, โ€ฆ in apps/web/src/rightPanelStore.ts) have no back stack.

One possible approach: a single capture-phase mouseup/auxclick handler on the right panel root that calls preventDefault() for buttons 3/4. It would route to the active browser tab's goBack/goForward (or history(delta) for server tabs) when the active surface is preview, and otherwise to a panel-level surface history, or simply swallow the press.