adobe / spectrum-web-components

Spectrum Web Components
https://opensource.adobe.com/spectrum-web-components/
Apache License 2.0
1.21k stars 192 forks source link

[Bug]: indeterminate state for `sp-swatch` shows an "Elements must only use supported ARIA attributes" error #4518

Closed Rocss closed 4 weeks ago

Rocss commented 1 month ago

Code of conduct

Impacted component(s)

sp-swatch

Expected behavior

No accessibility warnings should be thrown

Actual behavior

Issue was observed in Express, but it is reproducing on Spectrum Web Components documentation as well: https://opensource.adobe.com/spectrum-web-components/components/swatch/

Screenshots

Screenshot 2024-05-29 at 14 12 58 Screenshot 2024-05-29 at 15 03 21

What browsers are you seeing the problem in?

No response

How can we reproduce this issue?

  1. Go to https://opensource.adobe.com/spectrum-web-components/components/swatch/
  2. Open the axe-devtools extension and run a full scan of the page
  3. Observe the accessibility error: "Ensures an element's role supports its ARIA attributes"

Sample code that illustrates the problem

While aria-checked="mixed" would be useful in a sp-swatch-group where the role of the sp-swatch would be checkbox, in a single sp-swatch which surfaces the role=button, the use of aria-checked is invalid. The "mixed" state should be part of the aria-label in this case.

Logs taken while reproducing problem

No response