Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
afercia opened this issue Jun 4, 2024 · 4 comments · Fixed by #62480
Closed

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

afercia opened this issue Jun 4, 2024 · 4 comments · Fixed by #62480
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jun 4, 2024

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

@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Feedback Needs general design feedback. [Package] Components /packages/components labels Jun 4, 2024
@jasmussen
Copy link
Contributor

What design feedback are you looking for? I'd echo this seems like a bug as far as the appearance of the focus style on the disabled button.

@jasmussen jasmussen removed the Needs Design Feedback Needs general design feedback. label Jun 10, 2024
@afercia
Copy link
Contributor Author

afercia commented Jun 10, 2024

From a design perspective I would like to know what is the desired focus style for aria-disabled buttons.

This one, where the blue outline is dimmed:

Screenshot 2024-06-10 at 14 20 17

or this one where the blue outline is the standard one?

Screenshot 2024-06-10 at 14 25 18

In this case, when the 'Show button text labels' preference is enabled, the button shows text and also becomes tertiary thus surfacing the focus style inconsistency.

From an accessibility perspective, I'm not sure there is a standard for this case. However, I'd tend to think the focus style should be clearly visible for aria-disabled controls. Cc @joedolson any thoughts?

@joedolson
Copy link
Contributor

The focus needs to be fully visible. While it is acceptable to have disabled components below color contrast, per WCAG 1.4.3, that only refers to the component itself. The focus outline is a positional marker to allow a user to identify their current position in the page, and that needs to meet contrast guidelines. The user's need to know where they are in the interface doesn't go away just because the control is disabled.

@afercia afercia self-assigned this Jun 11, 2024
@afercia
Copy link
Contributor Author

afercia commented Jun 11, 2024

One more case to adjust: when hovered, the text of the is-destructive button becomes gray. Is thould stay light red.

Screenshot 2024-06-11 at 11 19 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants