virtual icon indicating copy to clipboard operation
virtual copied to clipboard

scrollToIndex center - incorrect align

Open PurpleTape opened this issue 2 years ago • 1 comments

Describe the bug

When a scrollToIndex call is made, a scroll to the index block occurs.

If scrollToIndex align value has start, then the scroll will be scrolled so that the upper part of the index block coincides with the upper border of the parent block

If scrollToIndex align value has end, then the scroll will be scrolled so that the lower part of the index block coincides with the lower border of the parent block

If scrollToIndex align value has center, then the scroll will be scrolled so that the upper part of the index block coincides with the central line of the parent block, but there is no alignment along the central line of the index block

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/wonderful-swanson-vczltl?embed=1&file=%2Fsrc%2Fmain.tsx%3A35%2C23-35%2C36

Steps to reproduce

  1. Go to reproduce link
  2. Open browser console (Here you can see the random index to which the scroll is made)
  3. Press "scroll to the middle"

Expected behavior

scrollToIndex with the value center is called so that the block with the specified index is aligned along the center line of the parent and relative to itself

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

macOS Firefox 114.0.1

tanstack-virtual version

3.0.0-beta.54

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] 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.

PurpleTape avatar Jun 17 '23 03:06 PurpleTape