Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): make floating browser previews easier to drag #15499

Closedelliptic1(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/15499/headopened View on GitHub

Problem

Floating browser previews expose only a 12px grip in the top-right corner. Moving the preview is difficult to discover and grab. Its layout also pushes and narrows the prompt instead of letting the browser float over it. The baseline recording reproduces a failed drag near the page's top and a successful drag from the tiny corner.

Change

Add a persistent, full-width 36px drag header with a grip and label. Its action buttons keep their existing behavior and cannot start dragging. Account for the header in frame sizing and resizing so page proportions remain correct. Floating browsers now overlay the chat and prompt without shifting or narrowing them; only the canvas edges constrain movement. Device previews retain their existing layout behavior.

Keep pointer capture on a stationary, temporary shield above the native webview. The desktop test exposed capture loss when the moving header owned it. Release, Escape, cancellation, focus loss, and unmount remove the shield and listeners.

Scope and approval

Submitted as a focused fix to the existing floating preview under the obvious-bug exception: the tiny grab target and interrupted drag are reproduced below. There is no linked maintainer approval. The shell and its geometry/gesture tests are the scope; native mobile, provider adapters, and transport contracts are unaffected.

Verification

  • 77 tests passed across the preview gesture, preview layout, and chat canvas layout suites. Scoped lint, web typecheck, and git diff --check passed.
  • Real desktop integration: macOS, Electron 44.4.2, isolated worktree state and Electron profile, with a local interactive page in an actual native webview. Dragged from the left/middle of the header and across the guest's bounds; verified retained capture, resizing, release cleanup, and Escape while held.
  • Verified the docking button does not start a drag; address-bar text selection, preview menu, guest click counter/text editing, links, Back/Forward/Refresh, second-tab navigation/switching, and floating close all worked. The header stays 36px with larger UI text.

The outer-window drag tests used Electron native sendInputEvent (trusted Chromium events); guest control checks also used macOS accessibility. The computer-control coordinate API returned noWindowsAvailable, so an OS-origin mouse drag was not verified. Pointercancel/blur/unmount have unit coverage; native release and Escape were exercised. Windows/Linux, touch, and remote clients were not tested.

Detailed steps, commands, observations, and limitations · Native assertion results

BeforeAfter
Before: tiny top-right gripAfter: full-width drag header

Before video: corner-only drag · After video: dragging, native guest boundary, resizing, release and Escape

The follow-up desktop test dragged the browser directly over the editable prompt and confirmed that the native webview wins hit testing. The prompt rectangle stayed exactly unchanged during drag, resize, release, and Escape cancellation.

Floating browser above the unchanged prompt

Overlay video: move and resize above the prompt · Overlay assertions

The clips use actual outer-window capture frames with their recorded timing, including the guest rendering; the OS cursor is not captured. Media is uploaded to GitHub release assets only, not committed.

Model: GPT-6-Astra. Harness: Codex in T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The PR changes the default floating browser preview UI and shared drag/resize lifecycle, including frame sizing, webview placement, and cross-webview pointer capture. It introduces a new production gesture shield and broad event cleanup behavior, so the change warrants human review despite its focused scope and added tests.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Important

      Review skipped

      We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

      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

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 7f1290b5-3dfe-4f38-9368-654ed0d843af
      📥 Commits

      Reviewing files that changed from the base of the PR and between 1109c9177e4a7bfcfc21127c49462b257ef2282a and 02ff77e0186a46d2464d6daac2feedba5f8af001.

      📒 Files selected for processing (4)
      • apps/web/src/components/chat/ChatCanvas.tsx
      • apps/web/src/components/chat/chatCanvasLayout.test.ts
      • apps/web/src/components/chat/chatCanvasLayout.ts
      • apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx

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


      📝 Walkthrough

      Walkthrough

      Browser mini-player previews now include a 36px header in frame sizing and show controls in a toolbar. Gesture tracking uses a shared helper with cleanup for pointer release and interruption events. Chat canvas layout and preview reporting account for header-height and overlay changes.

      Changes

      Preview header and interaction

      Layer / File(s)Summary
      Header-aware sizing and chat layout
      apps/web/src/components/preview/previewMiniPlayerLayout.ts, apps/web/src/components/preview/previewMiniPlayerLayout.test.ts, apps/web/src/components/chat/chatCanvasLayout.ts, apps/web/src/components/chat/chatCanvasLayout.test.ts
      Frame resolution and resizing account for optional header height. Chat canvas layout forwards the height and handles floating overlays. Tests cover frame bounds, resizing, and overlay placement.
      Browser header integration
      apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx, apps/web/src/components/chat/ChatCanvas.tsx
      Browser previews pass header height into the mini-player and place the preview surface below it. The mini-player displays a toolbar when a header is configured. Preview reporting stores changes to header height and overlay status.
      Gesture tracking and cleanup
      apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx, apps/web/src/components/preview/previewMiniPlayerGesture.ts, apps/web/src/components/preview/previewMiniPlayerGesture.test.ts
      Mini-player gestures use a shared helper to track matching pointer events and clean up on release or interruption. Tests cover pointer capture, cleanup, and late events.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix

      Sequence Diagram(s)

      sequenceDiagram
        participant MiniPlayerShell
        participant startPreviewMiniPlayerGesture
        participant BrowserEvents
        MiniPlayerShell->>startPreviewMiniPlayerGesture: Start gesture with pointer ID and callbacks
        BrowserEvents->>startPreviewMiniPlayerGesture: Send matching pointer move or release
        startPreviewMiniPlayerGesture->>MiniPlayerShell: Call move or finish callback
        BrowserEvents->>startPreviewMiniPlayerGesture: Send cancellation or lifecycle interruption
        startPreviewMiniPlayerGesture->>MiniPlayerShell: Call finish callback

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 02ff7

      The preview change is mergeable after normal checks. In an exceptionally short canvas, the browser preview may extend beyond its bounds.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 02ff7

      The change is contained to floating-preview layout and interaction, with no demonstrated new access or privilege. Input interception is temporary and has explicit interruption cleanup, but native-browser behavior is not independently verified here.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The reviewed interception scope is the host application window, broader than the preview rectangle. Its mutation scope is narrower: matching preview geometry within a scoped thread. The inspected callbacks do not grant new service, tenant, credential, or data-store authority.

      Trust Boundaries and Controls

      • inferred — The inspected wiring keeps header actions host-owned and routes them to panel opening, preview closing, and the existing native picture-in-picture bridge operation. Buttons stop pointer-down propagation, drag initiation excludes interactive targets, and the guest surface sits below the header. No new guest-to-host action path is established by these changes.
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 8 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Title check✅ PassedThe title clearly identifies the main change: making floating browser previews easier to drag.
      Description check✅ PassedThe description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the focused-fix exception, reports test and integration results, states limitations, a…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    4. Responding to the approvability assessment: understood—this changes the shared mini-player drag/resize lifecycle and warrants human review.

      The temporary shield addresses a failure reproduced in the Electron test: capture on the moving header could be lost when crossing the native webview. Capture now belongs to a stationary shield that exists only during the gesture. Interactive controls cannot initiate dragging; release, Escape, pointer cancellation, lost capture, focus/visibility loss, and source/thread changes or unmount clean up the shield and listeners.

      The latest commit, 02ff77e01, also makes floating browsers overlay the prompt without shifting or narrowing it. That layout change is browser-only; device previews retain their layout policy, though they share the gesture helper.

      Verification: 77 focused tests, scoped lint, and web typecheck passed. The isolated macOS Electron test exercised native guest boundaries, prompt overlap, resizing, release, and Escape. Overlay video · Detailed verification and limitations.

      The desktop drag tests used Electron-injected trusted events, not an OS-origin mouse drag. Windows/Linux, touch, and remote clients remain unverified. This evidence supports human review; it does not replace it.

Sign in to join this conversation.