Skip to content

fix: Fix Grid scrollToCell not able to scroll to last element when using autoHeight with WindowScroller - #1895

Closed
driskell wants to merge 1 commit into
bvaughn:masterfrom
driskell:fix-grid-scrolltocell-windowscroller
Closed

driskell wants to merge 1 commit into
bvaughn:masterfrom
driskell:fix-grid-scrolltocell-windowscroller

Conversation

@driskell

@driskell driskell commented Jun 6, 2026

Copy link
Copy Markdown
  • The existing test suites (npm test) all pass
  • For any new features or bug fixes, both positive and negative test cases have been added
  • N/A For any new features, documentation has been added
  • N/A For any documentation changes, the text has been proofread and is clear to both experienced users and beginners.
  • Format your code with prettier (yarn run prettier).
  • Run the Flow typechecks (yarn run typecheck).

NOTE: AI was used to help build the tests. The fix is completely my own.


When calling Grid's scrollToCell (maybe via List) and autoHeight is true because you might be using WindowScroller, when scrolling to the last item the scroll top is limited as if the Grid was the viewport. Even if you have items after the Grid allowing the window to scroll further it will never scroll past this point. It means with alignment of start, you can't actually ever scroll the last item to be at the start, it'll scroll to a point where that item is further down the page.

This removes the limitation on the scroll if autoHeight is true. Same logic is applied also to the scroll left logic.

Test is added too for both the position manager and the Grid.

@github-actions github-actions Bot added the Stale label Jul 4, 2026
@github-actions github-actions Bot closed this Jul 4, 2026
@driskell

driskell commented Jul 4, 2026

Copy link
Copy Markdown
Author

@bvaughn Hiya how do I reopen? Issue is still relevant and was hoping to hear back but there’s a stale bot that seems to close indiscriminately after 28 days 😬 Thanks

@bvaughn

bvaughn commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Sorry for the very long delay in getting back to you about this!

This is fixed in the upcoming version 10 of react-virtualized (#1900). WindowScroller and the autoHeight prop have been replaced by a scrollElement prop, and scrollToRow/scrollToCell on a window-scrolled component are no longer limited to the end of the Grid: with align: "start", the last rows can be scrolled to the top of the viewport when there is content below the Grid (the window or scroll element limits the offset itself). Thank you for the fix!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants