Describe the bug
ARC toolkit incorrectly flags an error, "Missing required aria-attribute", for aria-checked on <input type="checkbox" role="switch">
While the WAI-ARIA specification for role="switch" does list aria-checked under required states and properties, this must be read in the context of the rest of the document. §5.2.2 Required States and Properties states:
A host language attribute with the appropriate implicit WAI-ARIA semantic fulfills this requirement.
In this context, HTML is our "host language", and checked is a "host language attribute". Furthermore, §8.4 Implicit WAI-ARIA Semantics states that:
[…] there are many situations in which WAI-ARIA semantics are redundant with host language semantics. […] Features with implicit WAI-ARIA semantics satisfy WAI-ARIA structural requirements such as required owned elements, required states and properties, etc. and do not require explicit WAI-ARIA semantics to be provided. […] For example, if an element with the functionality already exists, such as a checkbox or radio button, use the native semantics of the host language.
(emphasis mine)
Since the switch role inherits from checkbox, the implicit aria-checked semantics provided by the native checked state on <input type="checkbox"> carry over when role="switch" is applied.
To Reproduce
- Go to ARIA APG: Switch Example Using HTML Checkbox Input
- Run tests on the page in ARC Toolkit
- See that errors are flagged for the switches in the example (under "Accessibility Preferences")
Expected behavior
There should be no errors flagged, as <input type="checkbox"> inherently exposes its checked state to the accessibility tree.
Screenshots
Version information
- Browser and version: Chrome 149.0.7827.54 (Official Build) (arm64)
- ARC Toolkit version: 5.7.10
Additional context
The accessibility tree in Chrome DevTools confirms that the checked state is correctly exposed without an explicit aria-checked attribute.
Initially, when the switch is off:
Role: switch
...
Checked: false
After turning the switch on:
Role: switch
...
Checked: true
Describe the bug
ARC toolkit incorrectly flags an error, "Missing required aria-attribute", for
aria-checkedon<input type="checkbox" role="switch">While the WAI-ARIA specification for
role="switch"does listaria-checkedunder required states and properties, this must be read in the context of the rest of the document. §5.2.2 Required States and Properties states:In this context, HTML is our "host language", and
checkedis a "host language attribute". Furthermore, §8.4 Implicit WAI-ARIA Semantics states that:(emphasis mine)
Since the
switchrole inherits fromcheckbox, the implicitaria-checkedsemantics provided by the native checked state on<input type="checkbox">carry over whenrole="switch"is applied.To Reproduce
Expected behavior
There should be no errors flagged, as
<input type="checkbox">inherently exposes its checked state to the accessibility tree.Screenshots
Version information
Additional context
The accessibility tree in Chrome DevTools confirms that the checked state is correctly exposed without an explicit
aria-checkedattribute.Initially, when the switch is off:
After turning the switch on: