-
-
Notifications
You must be signed in to change notification settings - Fork 407
Open
Description
Summary
Add built-in support for "auto-scroll to bottom" behavior, commonly needed for chat interfaces, logs, and similar use cases.
Problem
Currently, implementing auto-scroll to bottom with dynamic item heights is unreliable:
scrollToIndex(lastIndex, { align: "end" })often falls short with dynamic heights (v3.13.8 doesn't scroll all the way to the bottom correctly #1001)- No way to know when measurements are complete to safely scroll
- "Sticky bottom" behavior (stay at bottom unless user scrolls up) requires significant custom logic
Use Case
Chat applications, terminal/log viewers, and any interface where:
- Items are dynamically sized
- New items are appended at the end
- User expects to see the latest item automatically
- User can scroll up without being forced back down
Proposed API
const virtualizer = useVirtualizer({
count,
getScrollElement: () => parentRef.current,
estimateSize: () => 50,
// New option:
stickToBottom: true,
})
// New methods/properties
virtualizer.scrollToBottom()
virtualizer.isAtBottomRelated
SorooshGb, pan463859 and regenrek
Metadata
Metadata
Assignees
Labels
No labels