Skip to content

Scrolling up in Lit example stutters and resets scroll #981

Open
@blake-logik

Description

@blake-logik

Describe the bug

I was having problems with my Lit virtualizer stuttering when scrolling back up through a dynamic list and couldn't understand why the example worked, but mine did not. So I updated the height of the items in the example, and it started to break like mine. It seems the example only works well because each item takes up most of the scroll element.

Your minimal, reproducible example

https://tanstack.com/virtual/latest/docs/framework/lit/examples/dynamic?panel=sandbox

Steps to reproduce

  1. Open the Lit dynamic example: https://tanstack.com/virtual/latest/docs/framework/lit/examples/dynamic?panel=sandbox
  2. Change the lorem ipsum generator to make shorter sentences ex. faker.lorem.sentence(randomNumber(1, 20))
  3. Scroll down a ways and then scroll back up. It will start stuttering and reseting scroll. This gets worse the larger the difference in height between items.

Expected behavior

There should not be any stutter.

How often does this bug happen?

Often

Screenshots or Videos

No response

Platform

  • OS: Mac
  • Browser: Chrome

tanstack-virtual version

v3

TypeScript version

No response

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions