motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] Scroll reset on layout animation

Open JAWS-tm opened this issue 2 years ago • 2 comments

2. Describe the bug

I try to do a layout animation when I reorder a grid of elements. But for some unknown reasons when I reorder the list sometimes the scroll reset to the top of the page.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codepen.io/JAWStm/pen/ExrjQZj?editors=0011

When you click an element it will make it go the the begining of the list. And the bug will appear.

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Create a grid with some items
  2. Reorder the list using logic or random sort
  3. The scroll will be reset

5. Expected behavior

The scroll should stay at the same position every time.

6. Video or screenshots

No Video

7. Environment details

OS: Windows 10 Browser: Chrome

JAWS-tm avatar Oct 26 '23 12:10 JAWS-tm

Thanks for your help, but this don't fix the scroll. Do you have any other ideas ?

JAWS-tm avatar Oct 30 '23 15:10 JAWS-tm

I'm experiencing the exact same issue. I have a grid of items that I reorder randomly with setInterval. Sometimes the scroll position is changed, sometimes it isn't.

I've tried setting an explicit height on the parent div, but that doesn't seem to help. Any ideas?

ynamite avatar Jan 13 '25 13:01 ynamite