-
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: In list view, automatically insert header menu separators #55412
Conversation
In HeaderMenu, avoid the very error-prone logic involved in manually adding separators in between top-level items, and instead rely on an introspective component (WithSeparators) to do that task reliably.
</DropdownMenuV2> | ||
); | ||
} | ||
|
||
function WithSeparators( { children } ) { |
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 exact details of where this should live aren't really important to me, whether it's here in the module or somewhere to be reused, or incorporated in DropdownMenu.
Size Change: +44 B (0%) Total Size: 1.66 MB
ℹ️ View Unchanged
|
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.
That's cool, thank you!
For the record, I also explored an alternative that didn't rely on the Children API, since its use is discouraged. The alternative is more verbose and cumbersome, as it trades element trees for plain object trees. I'm attaching it here for future reference:
|
This should be reviewed with whitespace changes hidden.
In HeaderMenu, avoid the very error-prone logic involved in manually adding separators in between top-level items, and instead rely on an introspective component (WithSeparators) to do that task reliably. The complexity that this eliminates is expected to grow as more features result in more top-level items in header menus.
No visible or functional change is expected from this PR, but for reference these are the menus in question:
Before, a separator needed to be manually inserted in between the sorting group (top) and the visibility item (bottom).
Minor part of #55083