Skip to content

fix(web): reserve sibling column width when resizing the right panel - #6279

Open
Lasdw6 wants to merge 1 commit into
pingdotgg:mainfrom
Lasdw6:fix/preview-panel-chat-min-width
Open

fix(web): reserve sibling column width when resizing the right panel#6279
Lasdw6 wants to merge 1 commit into
pingdotgg:mainfrom
Lasdw6:fix/preview-panel-chat-min-width

Conversation

@Lasdw6

@Lasdw6 Lasdw6 commented Aug 12, 2026

Copy link
Copy Markdown

What Changed

The right panel's (diff/preview) resize clamp now reserves a minimum width for its sibling column (the chat, or the pull-request list) instead of only capping at 70% of window.innerWidth.

  • getPreviewPanelMaxWidth takes the panel's flex-row width and clamps to rowWidth − 360px, keeping the viewport fraction as a secondary cap and flooring at the panel's own 360px minimum so a too-narrow row cannot invert the resize clamp.
  • The row is measured with a shared measure callback (before first paint, then via ResizeObserver), so the clamp reacts to window and sidebar resizes and a persisted over-wide width cannot flash on mount. Measurement is skipped in modes that never apply the width (sheet, embedded, maximized).
  • Unit tests cover the fraction cap, the row clamp, and both narrow-row edge cases.

+90/−10 in PreviewPanelShell.tsx and its test file.

Why

Fixes #6181.

The clamp was blind to the app sidebar (which sits outside the 70% math) and to the chat composer's minimum content width. Whenever 0.3 × viewport − sidebar fell below what the composer needs, the composer overflowed the chat panel before the clamp engaged.

That threshold is roughly a 1950px viewport, which is why the issue looked macOS-only: every MacBook — even fullscreen at 1512–1728 logical px — is below it, while typical Windows desktop monitors are above it. Reproduced on Windows 11 at non-maximized window widths and on macOS fullscreen; the drag now hard-stops leaving the sibling column usable on both.

UI Changes

Before/after screenshots and drag recordings are in the comment below (macOS fullscreen, matching the issue's environment).

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

Note

Reserve sibling column width when resizing the right preview panel

  • Updates getPreviewPanelMaxWidth in PreviewPanelShell.tsx to accept an optional containerWidth and subtract a SIBLING_COLUMN_MIN_WIDTH (360px) reservation, so the preview panel cannot grow into the sibling column's space.
  • Replaces the viewport-only useViewportClampedMaxWidth hook with useClampedMaxWidth, which tracks both viewport width and the parent flex-row container width via ResizeObserver and useLayoutEffect to avoid over-wide flashes on mount.
  • Measurement is skipped entirely when not in inline non-maximized mode, avoiding unnecessary DOM observation.
  • Behavioral Change: in inline non-maximized mode, the panel's max width is now clamped by available container space rather than viewport width alone; the panel will never shrink below its own 360px minimum.

Macroscope summarized f6ed169.


Note

Low Risk
UI-only resize clamp change in the preview panel shell; no auth, data, or security-sensitive logic.

Overview
Stops the inline preview/diff panel from squeezing the sibling chat (or PR list) column on narrower windows by clamping max width to row width − 360px, not just 70% of the viewport.

getPreviewPanelMaxWidth now takes an optional container width, keeps the viewport fraction as a secondary cap, and floors at the panel’s own 360px minimum so a too-narrow row cannot invert useResizableWidth’s clamp. The flex row is measured with useLayoutEffect + ResizeObserver (skipped outside inline non-maximized mode) so window and sidebar resizes re-clamp without an over-wide flash on mount.

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

@coderabbitai

coderabbitai Bot commented Aug 12, 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: 4e37403a-ba40-4d72-8ecf-b9849ba0c6c6

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

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 Aug 12, 2026
@Lasdw6
Lasdw6 marked this pull request as ready for review August 12, 2026 05:56
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved f6d8dff

Straightforward UI bug fix that adds container width measurement to prevent the preview panel from squeezing its sibling column below minimum width. Changes are self-contained to layout constraints with comprehensive test coverage.

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

@Lasdw6

Lasdw6 commented Aug 12, 2026

Copy link
Copy Markdown
Author

Before

Image
t3code.before.mov

After

t3code.after.mov

The panel's drag clamp was 70% of window.innerWidth, blind to the app
sidebar and the chat column's minimum content width. On viewports under
~1950px (any fullscreen MacBook, or a non-maximized window on Windows)
the remaining space fell below what the composer needs, so it overflowed
the chat panel before the clamp engaged.

Clamp against the panel's flex row instead, minus a 360px reservation
for the sibling column, keeping the viewport fraction as a secondary
cap. The row measurement excludes the sidebar, reacts to both window
and sidebar resizes, happens before first paint so a persisted
over-wide width cannot flash on mount, and is skipped entirely in
modes that never apply the width (sheet, embedded, maximized). The
result is floored at the panel's own minimum so a too-narrow row
cannot invert the resize clamp.
@Lasdw6
Lasdw6 force-pushed the fix/preview-panel-chat-min-width branch from 871d8ed to f6ed169 Compare August 12, 2026 06:10
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]: AI chat panel overflows when the changed-file pane is widened

1 participant