Administration: Replace hardcoded 0.5px focus styles with the standard focus-width variable#12601
Administration: Replace hardcoded 0.5px focus styles with the standard focus-width variable#12601i-am-chitti wants to merge 1 commit into
Conversation
|
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. |
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. |
Ticket
https://core.trac.wordpress.org/ticket/65645
What & why
Since the 7.0 admin refresh, a few focus styles regressed to a hardcoded
box-shadow: 0 0 0 0.5px.0.5pxis a sub-pixel value — the browser rounds or anti-aliases it, so the focus indicator renders thinner and less reliably than intended.This PR replaces those values with the
--wp-admin-border-width-focuscustom property (fallback1.5px), the pattern already used across the admin styles. It resolves to:@media (min-resolution: 192dpi)),so the ring always maps to whole physical pixels and avoids sub-pixel rounding.
Changes
wp-admin/css/forms.css—#pass1/#pass1-textand.mailserver-pass-wrap .button.wp-hide-pw:0.5px→var(--wp-admin-border-width-focus, 1.5px).wp-includes/css/media-views.css—.media-frameinputs /select/textarea:0.5px→var(--wp-admin-border-width-focus, 1.5px).wp-admin/css/edit.css—div.tabs-panel-active:focus: addborder-color: var(--wp-admin-theme-color)so the 1px border and the box-shadow form a single uniform ring (a consistency fix; not a thin-value change — this selector already used the variable).Only the authored LTR source files are committed;
-rtl.css/.min.cssare build artifacts regenerated viagrunt rtl cssmin.Why the password case was hard to spot
The
#pass1and.wp-hide-pwselectors are also defined — correctly — in the admin color scheme (colors/_admin.scss→colors/*/colors.css), which loads afterforms.csson admin pages and masks the thin rule there. So the password regression is most visible on the Reset Password screen (wp-login.php), which loads no color scheme — where it was originally reported. The.media-frameand.tabs-panelcases have no such duplicate, so they are visible directly on their admin screens.Testing instructions
wp-login.php?action=rp&...): focus New password. Computedbox-shadowshould be... var(--wp-admin-border-width-focus, 1.5px) ...(→ 2px, or 1.5px on HiDPI), not... 0.5px ....selects, and the Alt Text field — all should show the samevar(--wp-admin-border-width-focus)ring (2px, 1.5px on HiDPI).Out of scope (raising as questions on the ticket)
These consistency items from the ticket need a design decision rather than a value swap, so they are intentionally left out of this PR:
media.css→.media-frame.mode-grid .attachment:focus, outset ring) and the editor's select-media modal (media-views.css→.wp-core-ui .attachment:focus, inset ring).Screenshots
Before -
Now -
Before -
Now -
Before -
After -
Use of AI
Claude Code Opus 4.8
Assisted with investigating the conflicting focus rules and drafting PR description; all changes were manually reviewed and tested before committing.