Skip to content

fix(web): preserve virtualized diff scrolling#4526

Open
Khrisseh1995 wants to merge 1 commit into
pingdotgg:mainfrom
Khrisseh1995:fix/diff-panel-scroll
Open

fix(web): preserve virtualized diff scrolling#4526
Khrisseh1995 wants to merge 1 commit into
pingdotgg:mainfrom
Khrisseh1995:fix/diff-panel-scroll

Conversation

@Khrisseh1995

@Khrisseh1995 Khrisseh1995 commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #4525

What Changed

Conditionally apply the existing top: 0 and bottom: auto overrides when all diff files are collapsed.

Why

Commit 38cfc25 made the override unconditional. This prevents the virtualizer from positioning expanded diff content and causes scrolling to drift.

Removing the override entirely restores a gap above the all-collapsed file list, so keeping it conditional preserves both behaviours.

UI Changes

Before: expanded diffs drift behind the scrollbar as files are traversed.

After: expanded diffs follow the virtualizer while collapsed file headers remain aligned below the toolbar.

Collapsed Spacing Video:

collapsed-spacing-before-after.mp4

Virtual Scroll Video:

virtual-scroll-varied-lengths.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A: interaction-only; see videos)

Note

Low Risk
Single conditional class change in DiffPanel UI styling with no auth, data, or API impact.

Overview
Fixes virtualized diff scrolling in the diff panel by only applying the virtualizer top/bottom CSS overrides when all diff files are collapsed.

AnnotatableCodeView previously always included [&>div>div:last-child]:top-0! and bottom-auto!, which broke the virtualizer’s positioning for expanded files and caused scroll drift. Those classes are now added via cn() only when allDiffFilesCollapsed is true, so expanded diffs scroll correctly while the all-collapsed header layout stays aligned.

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

Note

Fix diff render surface scroll position in non-collapsed state

The CSS overrides top:0 and bottom:auto on the last child of AnnotatableCodeView in DiffPanel.tsx were always applied, breaking scroll behavior when diff files are expanded. They are now conditional on allDiffFilesCollapsed, restoring correct virtualized scroll positioning in the non-collapsed state.

Macroscope summarized b71f197.

@coderabbitai

coderabbitai Bot commented Jul 25, 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: ef0c2098-6e5f-408d-96a9-491cc0d10514

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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:XS 0-9 changed lines (additions + deletions). labels Jul 25, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Minor CSS fix that conditionally applies styling for virtualized diff scrolling. The change is self-contained to a className prop and only affects visual behavior when all diff files are collapsed.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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]: Large diff panel jumps and drifts while scrolling

1 participant