T
TanStackโ€ข2y ago
stormy-gold

Expandable/collapse virtual items - change of scroll position when height is changed

Hi everyone! I've been using TanStack Virtual for managing a list of expandable/collapsible items within a scrollable container, and it's been great so far! However, I've encountered a specific issue that I could use some help with. The Problem: When I expand an item, I'm unable to see the top part of the expanded item, only the bottom. Conversely, when I collapse an item, the viewport scrolls to the upper part of the view, showing items above the collapsed one but not the collapsed one itself. Technical Details: Internally, I've noticed that scrollableContainer.scrollTop is changed whenever an item is expanded or collapsed. Attempted Solution: I tried restoring the previous scrollTop position for the scrollableContainer after an expand/collapse event, but this resulted in a blinking behavior that's quite annoying. ๐Ÿ™ Suggestions Needed: Do any of you have suggestions for resolving this issue? I'm open to trying different approaches to ensure a smoother user experience. Thanks in advance for any insights you can provide! ๐Ÿงช
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?