Skip to content

Button component: aria-disabled focusable button should use consistent focus style #62278

@afercia

Description

@afercia

Description

Discovered while working on #62267

Buttons can be made aria-disabled to still be focusable and this pattern has been recently made more solid in #62080

When aria-disabled buttons receive focus, their focus style should be consistent and this should be managed in the Button component itself. Instead, I observed that sometimes some aria-disabled buttons use a custom focus style.

An important note for accessibility is that:

  • Disabled controls don't have to meet the color contrast requirement.
  • However, the entire purpose of making aria-disabled buttons still focusable is to make them discoverable and perceivable when they receive focus. This should apply also to the focus style so that I'd argue the focus style should meet the contrast requirement. Feedback and thoughts welcome Cc @joedolson

The current situation of the focus style for aria-disabled buttons is pretty inconsistent and should be improved.

1
The Default button uses some opacity so that both the text and the focus outline are lighter:

default

2
The Primary button only makes the text lighter. The outline (a box-shadow actually) is different:

primary

3
The Secondary button only makes the text color lighter. Anyways, the text color is different from the one of the Default button (which uses opacity):

secondary

4
Same for the Tertiary button:

tertiary

Step-by-step reproduction instructions

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions