UI: Simplify focus ring styles#78823
Conversation
| /* Outline width must be kept at 0 even with a transparent color, | ||
| or else the outline will be visible in forced-colors mode. */ | ||
| outline: 0 solid transparent; |
There was a problem hiding this comment.
I cannot figure out why this was necessary 🤔 Maybe a remnant of a previous implementation.
| .outset-ring--focus, | ||
| .outset-ring--focus-except-active, | ||
| .outset-ring--focus-visible, | ||
| .outset-ring--focus-within, | ||
| .outset-ring--focus-within-except-active, | ||
| .outset-ring--focus-within-visible, | ||
| .outset-ring--focus-parent-visible { |
There was a problem hiding this comment.
This simplification makes it much easier to have consistent focus styles once these styles are shared more widely in a @wordpress/base-styles mixin. People will only need to use one mixin instead of two, and they won't have to think about transitions styles conflicting.
|
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 If 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. |
|
Size Change: -308 B (0%) Total Size: 8.21 MB 📦 View Changed
ℹ️ View Unchanged
|
| --_gcd-div-outline: var(--wpds-border-width-focus) solid var(--wpds-color-stroke-focus-brand); | ||
|
|
||
| outline: var(--wpds-border-width-focus) solid var(--wpds-color-stroke-focus-brand); | ||
| outline-offset: 1px; |
There was a problem hiding this comment.
It might make sense to use a border width token here. I think the idea is that the offset value is always the same as the border width.
What?
Simplifies the shared
@wordpress/uifocus ring utility styles, removing the transition and an unused force-colors mode tweak.Why?
The focus ring utility's
transitionshorthand is often overridden by component-level transitions, which makes the focus ring animation inconsistent across call sites.How?
Removes the shared focus ring transition and base outline styles. The utility now applies the outline and outline offset only in the active focus states.
Testing Instructions
Button,Link, or form controls.