adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
13.04k stars 1.13k forks source link

[RAC] Virtualized GridList jumping around when tab in #7041

Open tienpv222 opened 2 months ago

tienpv222 commented 2 months ago

Provide a general summary of the issue here

When tab into a virtual GridList, the scroll jumps around even though the GridListItem is in view.

๐Ÿค” Expected Behavior?

The scroll position should remain if the focused item is in view.

๐Ÿ˜ฏ Current Behavior

The scroll position jumps around. Provided a sandbox, but I also see this happens in the storybooks in closed PRs.

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

https://codesandbox.io/p/sandbox/27hddn

Version

1.3.3

What browsers are you seeing the problem on?

Firefox, Chrome, Microsoft Edge

If other, please specify.

No response

What operating system are you using?

Windows 11

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

Edit: added comment from the demo

This bug doesn't happen with non-virtual GridList, or with ListBox, or with virtual-GridList without Button in GridListItem.

snowystinger commented 1 month ago

Thanks for the issue, I'm able to see the unpredictable scroll into view.

Note for anyone trying to reproduce, make sure to focus an item that requires some scrolling to get to initially. It won't have an issue if you just leave it as the first item.