-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(aria/tree): create tree behavior #32569
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
base: main
Are you sure you want to change the base?
Conversation
wagnermaciel
commented
Dec 18, 2025
- Create a new Tree behavior and refactor the Tree UI Pattern to use it.
ok7sai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the prework for migrating menu to use the tree behavior?
0ef4766 to
25a2e15
Compare
@ok7sai Yep 👍🏽 |
| * The list of items to navigate through. | ||
| * Defaults to the list of items from the inputs. | ||
| */ | ||
| items?: T[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The items override feels a bit weird, because whether an override is provided or not, the moving index is always based on the activeIndex from the original input, and the following case becomes hard to reason out.
- ListNavigation is initiated with items A, and an active index of A.
- Navigation happens and a different items B is provided.
- Some logic internally handles the mismatch between active index of A and the items B.
This last part is implicit and not easy to observe.
This makes me think about maybe ListNavigation behavior should just be a set of utility methods, and each method always take all necessary informations (items, activeIndex, wrap, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think ListNavigation should be a set of utility methods since it would require a lot of args in order to perform its operations. Either way, this is outside the scope of this PR.
This strange behavior can be replicated by changing the inputs.items currently. We could prevent this misuse of the behavior with some strict checks that warn or error if these come up. I think we are over-anticipating future concerns that I'm not convinced we will actually encounter