Administration: Fix the focus ring size for meta box header buttons - #12712
Administration: Fix the focus ring size for meta box header buttons#12712itzmekhokan wants to merge 1 commit into
Conversation
Adding tooltips to the meta box move up, move down, and show/hide buttons wrapped them in a `.wp-tooltip` element, and the tooltip focus style is more specific than the meta box one. Enabled buttons therefore draw the tooltip's outset ring while disabled buttons keep the meta box's inset ring, so the two do not match, and the outset ring is reported as being cut off in the block editor meta boxes area. Wrap the tooltip wrapper in `:where()` so it no longer contributes to the specificity of the focus style. Which elements the selector matches is unchanged, so disabled toggles are still excluded, and buttons that ship their own focus style, such as the meta box handles, now keep it. Follow-up to [62816]. Fixes #65727.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Adjusts wp-admin tooltip focus styling to prevent the tooltip wrapper’s selector specificity from overriding component-specific focus rings (notably in meta box header buttons), ensuring consistent focus ring appearance regardless of disabled state.
Changes:
- Lowers specificity of the tooltip toggle
:focusring selector by wrapping the tooltip wrapper portion in:where(). - Adds an inline comment explaining why
:where()is used (specificity-only change, preserving matching behavior).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Levels the focus ring on the meta box header buttons (move up, move down, show/hide) so all three match, whether or not the button is disabled.
What the problem was:
.wp-tooltipto add tooltips. The tooltip's focus rule is.wp-tooltip:not(:has(button[aria-disabled="true"],button[disabled])) .wp-tooltip__toggle:focus, which scores (0,4,1) —:not()takes the weight of the most specific argument of:has(),button[aria-disabled="true"]..postbox .handle-order-higher:focusscores only (0,3,0), so enabled buttons draw the tooltip's outset ring while disabled buttons, excluded by the:not(:has()), keep the meta box's inset ring. The rings do not match, and the outset ring is reported as being cut off in the block editor meta boxes area.What the fix does:
:where(), dropping the rule to (0,2,0) so the meta box focus style applies to all three buttons.Approach and why:
common.css, and a generic wrapper should not be dictating the focus style of a button a component passed in — so:where()on the wrapper is the smaller and more correct change.:where()changes specificity only, never what the selector matches, so the disabled-toggle exclusion added in [62816] is preserved, and tooltips that use the component's own generated button are unaffected.:has()this selector already required.Trac ticket: https://core.trac.wordpress.org/ticket/65727
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Ticket analysis and writing PR description. All changes were reviewed and validated by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.