Repository navigation
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +1.59 kB (+0.02%) Total Size: 8.66 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. As a user I want to be able to add multiple close buttons so that users can close the overlay from different positions in
|
mirka
left a comment
There was a problem hiding this comment.
To be honest I think it would be risky to get this into 7.2 at this stage, given the potential for unexpected things to happen. There seem to be many possible content compositions of this DropdownMenu component, which makes it hard to assess the effects of the layout change without actually seeing all the different compositions in context.
Even the ToolsPanel for example, it's hard to say the new layout is an improvement over the current. Which might even mean that it may be safer to leave this component alone, backport or not, and have consumers replace the existing usages with the new Menu layout at their discretion so it doesn't cause noticeably degraded experiences. I think there should at least be an audit of the existing compositions before moving forward with a component-level change.
There was a problem hiding this comment.
The existing Multi Selection story still renders checks on the right, while MenuItemsChoice and ToolsPanel now put them on the left. I think we should update that?
But also, the existence of this pattern worries me, because we can't do anything about third-party usage that already does this. It looks like we even have two such cases in the codebase.
There was a problem hiding this comment.
Both stories now use the new MenuItem showSelectionIndicator prop, and legacy trailing-check coverage lives in tests. The preference toggles, aspect-ratio choices, and block-state preview toggle use the same composition in 4f6a562da3b.
6d0ef1d to
53ed5e0
Compare
|
Gotcha re. not backporting - hopefully we won't get additional feedback about the legacy and new I've added the composition audit and refreshed comparisons, and made the direct |
mirka
left a comment
There was a problem hiding this comment.
A new API at this point is interesting. What's the plan for these components? I would have expected these to be unrecommended soon and nudged to move to Menu. Or are we going to keep MenuItem* around? Asking because it was unclear whether this is just a quick way to migrate in-repo usage, or if we are actually encouraging consumers to migrate to this new prop rather than moving to Menu.
I kind of expected an opt in to the new layout to mean a migration to Menu. But maybe there are use cases not covered by that?
|
It's all a balance. Especially if we don't want to rush with migrating all components (a point made earlier today re. the I'm also ok with not adding this API, the trade-off is that the potential visual inconsistency between |
138a3a6 to
ed52de3
Compare
|
I've dropped Plugin authors can keep their existing |
Let the Components stylesheet place the check so independently updated menus keep their existing layout with older styles. Give the radio choices their own group in the mixed-menu example and document the supported icon type.
bb510ff to
44eebe8
Compare
| } } | ||
| role="menuitemradio" | ||
| isSelected={ ratio === value } | ||
| className="components-menu-item__selection-row" |
There was a problem hiding this comment.
It looks like we're treating this like a utility class now. Doesn't this go against the standard guidance to not have class names cross component boundaries?
There was a problem hiding this comment.
Not immediately sure why the utility class name approach had to be taken, but if that's a necessity for some reason, I think that gives us a stronger case to prefer migration to Menu rather than try to alter DropdownMenu/MenuItem.
|
As also discussed in #85960 , I'm closing this PR since the changes required to reach layout consistency in |
Follow-up to #85831.
What?
Move selection checks before the labels in
MenuItemsChoice,ToolsPanel, Widgets preference toggles, the style state menu, and the legacy image aspect-ratio picker.Why?
Checks should line up with their labels, including labels with descriptions. Toggling a choice should keep the label and menu width steady.
How?
Gutenberg supplies the check through the existing
MenuItemicon props. Its internal row style reserves space when unchecked and aligns action labels in mixed menus. Plugins can continue to supply their own icons. For new menus in Gutenberg, useMenufrom@wordpress/ui.Testing Instructions
Testing Instructions for Keyboard
Focus a menu button and press Enter. Use the arrow keys to reach a choice, then press Enter to activate it. Press Escape in the open menu and check that focus returns to the button.
Screenshots or screencast
Playground integration checks
These Playground captures are from the earlier implementation at
4f6a562da3b, using WordPress 7.1.4 and PHP 8.3.36. The block-state menu now puts the state choices on the leading side as well.Earlier Chromium Storybook captures at 720 × 650. The before images use trunk
fc3fc980f94. The after images show the previous implementation of the leading-check layout.Theme and unchanged-composition comparisons
Related
@wordpress/uireferences: rich items, radio items, and checkbox items.Use of AI Tools
Implemented and verified with Codex.