Skip to content

Administration: Fix the focus ring size for meta box header buttons - #12712

Open
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65727-metabox-header-focus-ring
Open

Administration: Fix the focus ring size for meta box header buttons#12712
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65727-metabox-header-focus-ring

Conversation

@itzmekhokan

Copy link
Copy Markdown

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:

  • [62816] wrapped the three meta box header buttons in .wp-tooltip to 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:focus scores 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:

  • Wraps the tooltip wrapper in :where(), dropping the rule to (0,2,0) so the meta box focus style applies to all three buttons.

Approach and why:

  • The ticket suggests either lowering the tooltip specificity or raising the meta box's. Raising the meta box's would need a contrived selector to beat (0,4,1) from 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.
  • Support is a strict superset of the :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.

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.
Copilot AI review requested due to automatic review settings July 27, 2026 12:06
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props khokansardar.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :focus ring 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.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants