Skip to content

scrollToIndex with center align breaks user scroll #467

@egorprnn

Description

@egorprnn

Describe the bug

After calling scrollToIndex with center position and 0 index breaks user scrolling.
This is also reproduced with scrollToOffset and 0 offset.

Your minimal, reproducible example

https://codesandbox.io/s/silly-rain-0djsl0

Steps to reproduce

  1. Open sandbox.
  2. Click scroll to 0 index button.
  3. Start scrolling virtual items.

Expected behavior

Normal scrolling

How often does this bug happen?

Every time

Screenshots or Videos

Untitled.mp4

Platform

  • OS: MacOS
  • Browser: Chrome 108

tanstack-virtual version

3.0.0-beta.34

TypeScript version

4.8.4

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