Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): floating preview page follows its frame when the sidebar toggles #13924

Closedotavio(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/13924/headopened View on GitHub

What Changed

  • BrowserSurfaceSlot now re-measures when its nearest [data-browser-surface-container] ancestor resizes. Before, the slot matched only the inline preview panel ([data-preview-panel-mode="inline"]). The inline panel shell carries the new marker, so its behavior is unchanged. This is the first commit, a refactor with no behavior change.
  • The floating mini player marks its chat-column container with the same attribute, so the page re-measures whenever the column resizes. This is the fix commit.

Fixes #13776

Why

The mini player's frame is positioned relative to the chat column. The page inside it is a position: fixed Electron <webview> placed at the slot's last measured screen rect. When the sidebar collapsed or expanded, a player docked on the left kept the same column-relative x/y. Neither its own size nor layoutVersion changed, so nothing re-measured, and the page stayed at its old screen position over the chat.

When the sidebar toggles, the column resizes, both with animation (every frame) and without it (one jump). Observing the column is the smallest signal that covers both cases, as well as stored positions whose relative origin does not change. The fix reuses the same mechanism #12329 added for the inline panel instead of adding a second special case to the slot.

UI Changes

Desktop app, mini player dragged to the left edge of the chat, then the sidebar collapsed (synthetic demo project):

Before: frame at x=12, page left behind at x=268 over the chatAfter: page follows its frame to x=12
beforeafter

Verification

  • Reproduced on main in the Electron dev app. After the sidebar collapsed, the frame was at x=12 and the webview stayed at x=268.
  • With the fix, frame and webview match after collapse and after expand. This holds with panel animations off, and with 300 ms animations when positions are sampled on every frame during the transition.
  • Inline preview panel regression check: after closing and reopening the right panel, the slot and the webview are still aligned.
  • vp test run src/browser/BrowserSurfaceSlot.test.tsx: the new test fails on the original slot code and passes after the refactor.
  • tsc --noEmit in apps/web is clean. Targeted vp lint and vp fmt are clean, apart from the existing layoutVersion exhaustive-deps warning.

Device mini players render in the DOM and are unaffected. The web and mobile clients have no hosted webview, so they need no change.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes (the bug is the settled position, not the motion)

Prepared with Claude Opus 5.5 (Claude Code harness).

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

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 6c8cdad

      Macroscope's review found this PR approvable — This is a small, well-contained UI bug fix that makes existing browser preview surfaces track their moving containers during sidebar transitions. It adds targeted resize observation and a focused regression test without changing schemas, defaults, deployment, or static-analysis configuration.

      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: 1e20f2d0-6dc1-449e-9890-4c249ffddf1a
      📥 Commits

      Reviewing files that changed from the base of the PR and between 01a17930a6e8f8e1fe2516e4c99a7f46740568a4 and 6c8cdadb4de8bf46ed75e9fe5bbb107177f7b89b.

      📒 Files selected for processing (2)
      • apps/web/src/components/preview/PreviewPanelShell.tsx
      • 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; 8 remain after this review.


      📝 Walkthrough

      Walkthrough

      Preview containers are marked for browser-surface resize tracking. BrowserSurfaceSlot observes the nearest marked ancestor and updates the presented bounds when that ancestor resizes.

      Changes

      Browser surface resize tracking

      Layer / File(s)Summary
      Mark preview containers
      apps/web/src/components/preview/PreviewPanelShell.tsx, apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
      Inline preview shells and mini-player containers receive the data-browser-surface-container attribute.
      Observe container and update slot
      apps/web/src/browser/BrowserSurfaceSlot.tsx, apps/web/src/browser/BrowserSurfaceSlot.test.tsx
      BrowserSurfaceSlot observes the nearest marked ancestor. The test checks that the observer callback presents the slot’s updated bounds and expected arguments.

      Priority: ⬇️ Low

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 6c8cd

      The sidebar toggle resizes the marked mini-player container, allowing the page to follow its frame. No actionable merge risk is established, so the change appears ready for normal checks.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 6c8cd

      The change keeps floating previews aligned without changing their tab identity or granting additional privileges. No introduced security issue was established, but ownership during overlapping views and callback delivery around cleanup remain incompletely verified.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The added trigger affects presentation of an already selected preview tab. The marker cannot select another tab: the slot retains its captured tabId, and competing ownership is managed within the corresponding store entry.

      Trust Boundaries and Controls

      • inferred — The new ancestor marker is a layout signal, not an authorization credential. Additional resize callbacks reuse existing ownership checks rather than bypassing them. This supports rejecting a direct cross-tab authority-expansion concern, but does not resolve same-tab ownership contention.

      Resilience and Maintainability Implications

      • observed — The existing failed-presentation fallback can replace a lease owner, while cleanup has no explicit inactive flag checked by the update closure. A callback delivered after cleanup would therefore enter reacquisition if presentation remained visible. Such native callback delivery was not established, so this conditional behavior is not retained as a vulnerability or an introduced concern.
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main fix: keeping the floating preview page aligned with its frame when the sidebar toggles.
      Description check✅ PassedThe description explains the problem, implementation, scope, linked issue, UI impact, verification results, regression checks, and screenshots. It does not use the template headings exactly and does n…
      Linked Issues check✅ PassedThe changes satisfy the coding requirements in [#13776]. BrowserSurfaceSlot observes the nearest data-browser-surface-container and re-measures when that container resizes. MiniPlayerShell marks…
      Out of Scope Changes check✅ PassedThe changes remain within [#13776]. They update shared surface measurement, mark the affected mini-player and inline-preview containers, and add a focused regression test. No unrelated product behavio…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. Note

      Grok responding on behalf of Julius.

      Superseded by #16961, which already fixed #13776 (mini player page stays behind when the sidebar toggles) and closed that issue as completed. Closing this PR as leftover hygiene — thanks for the focused fix.

    6. juliusmarminge closed this

Sign in to join this conversation.