A Switch ARIA Role is missing required aria attributes
| Field | Value |
|---|---|
| Rule code | Switch_AttributeRequirement_Missing |
| WCAG conformance level | A |
| WCAG success criterion | 4.1.2 Name, Role, Value |
| Must be fixed at source | No |
Description
The Switch ARIA role requires the 'aria-checked' attribute to communicate its state (on/off) to assistive technologies. Without this attribute, users relying on screen readers or other assistive tools won't be able to determine the switch's state, causing accessibility issues. The aria-checked attribute must be set to 'true' for the 'on' state or 'false' for the 'off' state. More details: https://www.w3.org/TR/wai-aria-1.1/#switch.
How to fix
Ensure each element with role='switch' includes the 'aria-checked' attribute to indicate its state (e.g., <div role='switch' aria-checked='true'></div> or <div role='switch' aria-checked='false'></div>).