TanStack / TanStack/virtual

Expanding rows in a virtualized table will cause it to scroll to top

Open
#656 6 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
466
Avg merge
2d 31m
Merged PRs (30d)
13

Description

Describe the bug

When implementing expandable rows in a virtualized table, toggling an expandable row will immediately cause the table to scroll to top regardless of where the the current scroll offset is.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-virtual-xdmecx?file=src%2FApp.svelte

Steps to reproduce
  1. Scroll down table.
  2. Toggle on/off an expandable row.
  3. Table will immediately scroll to top.
Expected behavior

I expect to be able to toggle an expandable row and still be able to see it in it's current scroll position. Instead, It scrolls all the way to the top.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

MacOS, Brave browser v1.62.153

tanstack-virtual version

3.0.2

TypeScript version

^5.0.2

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior using the linked StackBlitz example, starting with src/App.svelte and the virtualized table's row-expansion handling. Verify that toggling an expanded row after scrolling preserves the current scroll position rather than returning to the top, and add or update a regression test if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.