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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +953 B (+0.01%) Total Size: 8.25 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
|
|
I'm a little bit anxious about adding a variant just to support one unique piece of UI (toolbar). What's to stop consumers misusing? Would it be better to wrap toolbars in a |
It would be, but that's a much bigger task. I mentioned it in the PR description that in the future we should indeed use a high-contrast setting on |
|
Of course you did, sorry I totally skipped that notice. I guess if we're happy to deprecate in the future this seems fine. |
| /** | ||
| * Set `variant="high-contrast"` on each popup, including submenu popups, to use | ||
| * a strong border and separators, small radius, and no shadow. | ||
| */ |
There was a problem hiding this comment.
Given the misuse risk, can we add stronger guidance on when exactly this variant should be used?
And regarding the risk of the design changing in the future, it might be useful to know whether this variant is only relevant to first-party development, or if there are instances where third-parties need to use it.
Based on how narrow we can make the usage guidance, we could perhaps even choose a better name for the variant. So if the design spec changes in the future, we could just change the design of the variant while also deprecating it. high-contrast makes that impossible. I know the name was chosen to be less prescriptive, but given the misuse and design change concerns, it might actually be better to be more prescriptive.
Just some thoughts.
There was a problem hiding this comment.
If we make the variant inherit (and/or even move it from the popup to the root), then I assume that third party consumers wouldn't really need to set it.
Re. the name, we could move back to toolbar, and otherwise the other name that came to mind was strong 😅
There was a problem hiding this comment.
I still don't think it's appropriate to test styles like this 😅
There was a problem hiding this comment.
This would ideally be a snapshot (ie viz reg) test, but we don't have the infra for it.
Would you rather remove the test entirely? Happy to do that
|
Could be my eyes, but the corner radius looks wrong. It's tricky, 2px isn't 2px if the stroke is on the outside, then it's 1px. Not saying we should move the stroke on the inside, just that the math is dependant on whether the stroke is inner or outer. If it's outer, the radius should be [radius + border-width]. |
|
I'm also echoing @t-hamano 's point about #83850 being an implicit dependency to this PR. I'd be personally in favaour of dropping the "high contrast" look altogeher from the toolbar, which would then implicitly make this "high contrast" variant not needed. It feels like a cleaner direction, more aligned with the DS visual language. |
|
Closing this PR as I'm hoping that we can end up following the following approach:
Solution no. 2 would retain the current look in a DS-compliant way, although it would take longer to get there |
Follow-up to the high contrast variant discussion in #82966.
What?
Add
variant="high-contrast"toMenu.PopupandPopover.Popup.Why?
Block toolbar popups need a stronger boundary than the default popup styling. A shared visual variant makes that appearance available without repeating custom styles in each consumer.
How?
Use a token-based dark border, small corner radius, and no shadow. Share the styling between both components. Menu separators and the Popover arrow match the popup border. Each popup opts in explicitly, including submenu popups. Existing default and unstyled appearances stay the same.
This PR adds the component support and Storybook examples. Adoption in toolbar consumers can follow separately.
Testing Instructions
npm run storybook:devand open Menu → High Contrast under@wordpress/ui.Testing Instructions for Keyboard
Open the Menu with Enter, navigate to Move to with arrow keys, and open the submenu with Right Arrow. Escape should close the menus and return focus to the trigger. Open the Popover with Enter. Escape should close it and return focus to its trigger.
Screenshot
Follow-up
Note
If the theme gains a high contrast setting, consumers could wrap an individual Menu or Popover in a high contrast theme provider. That could make this
variantprop unnecessary and provide a better long-term approach. We are not ready to implement that theme-wide setting yet.Use of AI Tools
Implemented and verified with OpenAI Codex.