fix(web): keep browser pages aligned during panel animations #12329
main fromrefs/pull/12329/head·merged by juliusmarminge View on GitHubClosing the last browser tab with X and opening a chat link can leave the integrated browser blank when panel animations are enabled. The page loads successfully, but its fixed-position surface keeps the panel's initial offscreen position.
Observe the inline panel as well as the browser placeholder. The panel animates its outer width while the placeholder stays at full width, so observing only the placeholder misses its movement. The existing observer cleanup covers both elements.
Verification#
- Regression test fails on the original code and passes with the fix, including observer cleanup on unmount.
- 15 focused browser tests pass; web typecheck passes; targeted formatting/lint passes with one existing effect-dependency warning; React Doctor reports 100/100.
- Reproduced the native X-close → chat-link reopen flow in an isolated Electron app with 100 ms panel animations. On the original code the page remained at x=1100, outside the window, while its placeholder settled at x=618. With the fix, 20 animated close/reopen cycles ended with matching positions.
Before / after#
Actual base (e26af33b2287) and fixed code, matching fixture and viewport. The unrelated composer is hidden in both captures. Recordings omit idle waits between actions.
| Before: reopened page is blank | After: reopened page is visible |
|---|---|
![]() | ![]() |
Before recording:
After recording:
Prepared with the Codex harness.
Summary by CodeRabbit#
Bug Fixes
- Improved inline preview panel updates during resizing and animation.
- Surface positioning now stays accurate when the panel moves, even if the slot size remains unchanged.
Tests
- Added coverage for panel movement across multiple widths.
- Verified proper cleanup and fallback behavior when the preview is closed.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
A prior Macroscope approval was dismissed. Re-evaluating f2259a7…
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Team
Run ID:
7608f953-b980-4c51-ba99-bf23675fbcbe📥 Commits
Reviewing files that changed from the base of the PR and between e26af33b228792bb72349ca4e849a96381578a57 and d6b53b8d652ef117d790216c3958ff9f319d904c.
📒 Files selected for processing (2)
apps/web/src/browser/BrowserSurfaceSlot.test.tsxapps/web/src/browser/BrowserSurfaceSlot.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough#
BrowserSurfaceSlotnow observes the nearest inline preview panel. Tests verify position updates during panel opening and observer cleanup after unmounting.Changes#
Preview panel observation
Layer / File(s) Summary Panel resize handling
apps/web/src/browser/BrowserSurfaceSlot.tsx,apps/web/src/browser/BrowserSurfaceSlot.test.tsxBrowserSurfaceSlotobserves inline preview panel resizing. Tests verify rectangle updates across opening widths, fallback restoration, surface hiding, and observer disconnection.Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
bmdavis419Merge Risk: ⚪ Minimal · up to
f2259The browser surface now tracks the animated inline panel position and releases its observers on unmount. No actionable merge-blocking risk remains.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly identifies the web fix and its effect on browser page alignment during panel animations. Description check ✅ Passed The description explains the bug, the fix, verification results, and UI behavior. It includes before/after screenshots and recordings for the animation-related change. It does not use the template hea… Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. ✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 13.5 KiB 13.5 KiB −10 B (−0.1%) 15.1 KiB ✅ Codex Thread snapshot wire 7.1 KiB 7.1 KiB +1 B (+0.0%) 7.3 KiB ✅ Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB −11 B (−0.2%) 7.8 KiB ✅ Codex Live turn WebSocket decoded 56.3 KiB 56.3 KiB 0 B (0.0%) 66.4 KiB ✅ Codex Live turn messages 10 10 0 (0.0%) 21 ✅ Claude Total thread wire 13.5 KiB 13.5 KiB +28 B (+0.2%) 15.1 KiB ✅ Claude Thread snapshot wire 7.1 KiB 7.1 KiB −1 B (−0.0%) 7.3 KiB ✅ Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB +29 B (+0.4%) 7.8 KiB ✅ Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅ Claude Live turn messages 9 9 0 (0.0%) 21 ✅ Baseline:
e26af33· PR result:d6b53b8· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 114.0 KiB
- Claude decoded thread snapshot: 114.7 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
juliusmarminge merged this4cc984f
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed