Secondary and tertiary buttons have no focus ring when not fully disabled #56149
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
Needs Accessibility Feedback
Need input from accessibility
Needs Design Feedback
Needs general design feedback.
[Package] Components
/packages/components
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Buttons support the ability to retain focus while being disabled, via the
__experimentalIsFocusable
prop. However, when this is enabled on secondary and tertiary buttons, they do not have a focus ring. For example, the "Reset filters" button here is focused and only mostly disabled, but that is not visibly evident.This is caused by an issue of specificity in the CSS, with
.is-secondary
and.is-tertiary
overriding previously established focus styling for buttons usingbox-shadow
andoutline
:gutenberg/packages/components/src/button/style.scss
Lines 125 to 134 in 1bf654b
gutenberg/packages/components/src/button/style.scss
Lines 38 to 43 in 1bf654b
What is your proposed solution?
The fix could be as straightforward as changing the scope or specificity of one of the other rules, to allow for the focus styling to propagate. This is probably most easily achieved by moving the
box-shadow
andoutline
declarations into a sub-block:This will at least allow mostly-disabled buttons to pick up the focus styling applied to other controls:
The text was updated successfully, but these errors were encountered: