bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.43k stars 3.06k forks source link

`WindowScroller` increases `scrollTop` value when a list row gets expanded #1840

Closed FrancoARossi closed 3 months ago

FrancoARossi commented 4 months ago

Bug Report

I'm using WindowScroller, AutoSizer, List and CellMeasurer to create a list with rows that can be expanded. The scrollElement is not the window.

What is the current behavior?

If there's one or more rows above the visible part of the list, then expanding a row causes the WindowScroller's scrollTop prop to increase it's value causing the scrollElement to scroll downwards. The increase is always 16 and sometimes it does it twice in one expand.

Code Sandbox

What is the expected behavior?

Calling measure() on a row that has increased its height shouldn't affect the scrollTop value of WindowScroller.

Which versions of React and react-virtualized, and which browser / OS are affected by this issue? Did this work in previous versions of react-virtualized?

Browser Google Chrome Version 126.0.6478.127 (Official Build) (arm64)
OS macOS Sonoma 14.5
React 17
React DOM 17
react-virtualized 9.22.3

Code Sandbox uses react-virtualized 9.22.5 and React 18. The same issue appears there as well.

https://github.com/bvaughn/react-virtualized/assets/37131677/b799452e-e6b1-4a05-91db-cf508cf301e8