fix(web): preserve virtualized diff scrolling#4526
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: 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. |
Fixes #4525
What Changed
Conditionally apply the existing
top: 0andbottom: autooverrides 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
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/bottomCSS overrides when all diff files are collapsed.AnnotatableCodeViewpreviously always included[&>div>div:last-child]:top-0!andbottom-auto!, which broke the virtualizer’s positioning for expanded files and caused scroll drift. Those classes are now added viacn()only whenallDiffFilesCollapsedis 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:0andbottom:autoon the last child ofAnnotatableCodeViewin DiffPanel.tsx were always applied, breaking scroll behavior when diff files are expanded. They are now conditional onallDiffFilesCollapsed, restoring correct virtualized scroll positioning in the non-collapsed state.Macroscope summarized b71f197.