UI Components: Refactor BlockSettingsMenu and MoreMenu as DropdownMenu#14843
Conversation
Here's a comparison of what I see in Firefox between this feature branch and master.
|
|
Really nice work. Thank you for doing this.
This is what I see in both this branch and in master: In other words, I don't see the same "old" style as @mapk does in master, not sure why. But in any case as far as my testing goes, this GIF is correct looking, and very nice. I did notice one thing. Master: This branch: Since that menu is not part of the scope of this branch, feel free to ignore it. But as you can see that overflow menu is actually slightly improved in this branch, all that's missing is the correct hover style. If fixing that hover style is within reach, it'd be nice to fix! Otherwise, feel free to ship once we work out why Mark saw something different than I did. |
gziolo
left a comment
There was a problem hiding this comment.
Noting, that there is #12505 opened which describes anothe issue related to more menus - the top bar More Menu should be a unique ARIA menu. There is #13059 opened which tries to solve it. I raised an issue when doing review which reads as follows:
It seems like we need to introduce another component called
Menuwhich will haveroleset tomenu, its class name which will hide the label for the menu, and will always haveuseEventToOffsetset totrue. This will make it possible to leaveMenuGroupusage unchanged.
My point here is, that we should ensure that we refactor both menus in a way where they use the same symantics.
| <__experimentalBlockSettingsMenuPluginsExtension.Slot | ||
| fillProps={ { clientIds, onClose } } | ||
| /> | ||
| <DropdownMenuSeparator /> |
There was a problem hiding this comment.
I have some concerns about this component which is 100% visual and won't be noticeable for those having sight issues. The question is whether this separator exists only for better aesthetics or should menu groups be used instead?
There was a problem hiding this comment.
I have some concerns about this component which is 100% visual and won't be noticeable for those having sight issues. The question is whether this separator exists only for better aesthetics or should menu groups be used instead?
It's a very good point. Between your comment and #12505, it seems clear that proper groupings would have preferable semantics than what can be communicated with this line. I could see an attempt at an argument that some lines are truly intended to be purely visual flourishes, though it seems a weak one and certainly one which should be limited, if not actively discouraged. At the very least, it's not clear to me why not to use a proper hr element over the existing div.
We have the MenuGroup component which might serve some help here, though it seems to assume a label not currently present in the block settings menu.
The more I look at the menu entries and trying to consider what these groupings might be, the more I wonder if Remove Block really is in any way of a different classification than the other items, or if the line truly does just serve as visually emphasis (for its frequency? as an indicator of danger?).
Action items:
- Don't expose this as a publicly-available component
- Decide whether
MenuGroupis possible, recommended (advice welcome)
|
Thanks @mapk @jasmussen for spotting those styling issues! It's quite possible I'd overlooked a few, so I'll plan to take another pass at it. I'll note that it's proving to be a useful exercise in consistency, as those "inaccuracies" are exactly what one would expect the behavior for their own default
I must have missed that that this menu was using |
38efd4f to
bfdd43e
Compare
|
I applied the following changes to this PR:
I left more comments inline. |
Co-Authored-By: gziolo <grzegorz@gziolo.pl>
afa7bfa to
032167a
Compare
Rebased, I think I did it 2 hours ago already :) I think that the current proposal is very consistent and I'm personally happy with it. I also addressed the last remaining comment from @aduth (#14843 (comment)) with 032167a. |
gziolo
left a comment
There was a problem hiding this comment.
This is looking to be in good shape. Left a few comments.
I can't approve my own pull request, so you'll need to do as your discretion once the points are considered.
I'm approving this PR based on the feedback received so far. I will wait with merge until Monday to get other folks a chance to chime in. Thank you, everyone, for all the help so far ❤️
|
Tested this quickly and it seems to work well. |
|
Let's get this in. I will open a follow-up issue to get rid of all |




Previously: #13410 (comment) , #2989
Related: #14754
Supersedes: #13059
Fixes #12505, fixes #15318 (Single visible menu is made up of multiple menus)
This pull request seeks to refactor the block settings menu to use the
DropdownMenucomponent. This is part of a larger effort to consolidate and normalize behaviors between dropdown menus. Prior to this pull request, there was a fair amount of duplication and divergent behaviors between the block settings menu and the standardDropdownMenucomponent.There is not expected to be a difference in the look and feel of the block settings menu.
Design Notes:
The changes here err on the side of treating the block settings menu styles as the more correct iteration of dropdown menu styling. Notably, this has the following impact:
1px, from4pxto5pxImplementation Notes:
I operated on an assumption that the fact that block settings menus and "More Options" menu were not implemented as
DropdownMenuwas at least partly motivated by the amount of additional customization necessary for these menus being unsupportable by the base component. It's for this reason that I introduced a newchildrenrender function prop to serve as an alternative to the existing (limiting)controlsprop.As an alternative, I had also explored whether to allow elements to be intermixed with
controlobject definitions in the defaultcontrolsprop. There is a possible route here, but it is made difficult by the fact that (a) the menu items are likely to need access toonClose, (b) each element in an array needing akey, and (c) the confusion surrounding an overloaded array supports of an object and element formats. It's for this reason that I decided to stick with the render function and, if anything, I would suggest that in retrospect this makes more sense as a default anyways.It may help to review using GitHub's "Ignore white space changes" option (especially
BlockSettingsMenu).Testing Instructions:
Verify that the block settings menu (right-most in toolbar) looks and behaves effectively identical as to
master.Verify that More Menu (right-most in header) looks and behaves identically as to
masterwith one exception:Ensure unit tests pass:
Included Tasks:
DropdownMenuMenuGroupto stop usingNavigableMenuwhich wrongly narrows down arrow keys navigationKnown bugs:
There are 2 bugs which are being tackled separately:
Future Tasks:
DropdownMenuto useMenuItemcomponent in its default rendering ofcontrols