-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-aria list focus conflicting with wrapping code #3785
Comments
We could consider namespacing it or allowing people to specify a pattern. Any chance you'd be willing to make a PR for it? Maybe just namespacing it to start, |
namespacing sounds good. though i suspect that will require touching a few different spaces since its the Item component that sets this (i think) and that gets used in combination of a bunch of hooks |
Yeah, it's definitely in a few places. Fortunately, it's easy to find with a project string search. I count about 7-8 files it's in project-wide. I think namespacing is easier as well. Trying to centralize naming it seems difficult. |
@mitchellwarr just wanna double check the use case here: are you running into an issue with nested lists or just that you have items in a list that you are applying a |
I have two issues. Theres one where we are using our own We have a scrollable space like so
If that makes sense. So those item tags have data-keys for our needs and the list items have react-arias data-keys. The tags also happen to done using the aria menu implementation, meaning theyre wrapped in If i were to move the tags outside the listRef area, then i would need to wrap it in a different scrollRef anyway, which would require doing virtualised scrolling from what i can tell. So i've fixed our implementation by just doing all the focus and scrolling ourselves. If you want to close this issue it will no longer be affecting me. But I think namespacing it is still a good idea. |
I believe we've done the namespacing in feat: nested collection support |
🐛 Bug Report
Inside the useListBox hook for react-aria, it will focus on elements for you.
However that focusing uses a querySelector that finds
[data-key="key"]
inside the list area.This is the line, or one of them:
react-spectrum/packages/@react-aria/selection/src/useSelectableCollection.ts
Line 360 in 810579b
🤔 Expected Behavior
The hook should find the element to focus on
😯 Current Behavior
If there is any other element inside this area with data-key, then it conflicts and focuses on which ever one it found first inside the DOM element.
💁 Possible Solution
A more specific search to query would be good.
In my case though I am using other react-aria items inside the list area due to keeping it all in one scroll space. But I think I will need to move things and wrap everything in a manual virtualised scroll space to fix my issue
🔦 Context
Just trying to build a list and use data-key, data-label, data-component, data-disabled, and other of these for testing purposes.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: