-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DataViews: use DropdownMenuRadioItem component when possible #57505
DataViews: use DropdownMenuRadioItem component when possible #57505
Conversation
Size Change: +33 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
// selecting a sorting option automatically deselects the | ||
// previously selected one, even if it is displayed in | ||
// another submenu. The field and direction are passed via | ||
// the `value` prop. |
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.
We don't use the value
right now, so this part of the comment could be removed, right?
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 value
is required by radio items (both the DropdownMenuRadioItem
component, the underlying ariakit implementation, and radio inputs in general). In the component's internal logic, it is necessary to distinguish each radio item from the others within the same radio group.
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.
Sure, just referring to The field and direction are passed via the value prop.
part of comment. Is this part relevant?
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.
In my mind, it is — it complements the fact that name
is very generic and doesn't include field and/or direction. But I appreciate that it could sound superfluous to other devs.
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 think we can land this for now and we will have to revisit when sorting with multiple fields is supported. Thank you!
What?
Follow-up to #55625, following feedback from @oandregal .
This PR refactors code around radio menu items, using the actual
DropdownMenuRadioItem
where possible instead of the custom implementation.Why?
The custom implementation was added to workaround a limitation of the
DropdownMenuRadioItem
, which doesn't allow a radio item to be "unchecked" once it's been checked (see this comment for extra context).How?
By tweaking the
name
andvalue
of the radio groups, we can make sure that the "sorting" radio items update correctly (ie. get deselected).Testing Instructions
To load the Data View UI:
For this specific PR: