Closed tedw closed 8 years ago
Hey @tedw,
Thanks for reporting. AX_ARIA_10
is a little more specific than just checking a list of valid attributes - it also considers the role (either implicit or explicit!) on the element that has the aria attribute. For example, an aria-required
on an <input>
will pass the audit, while an aria-required
on a <button>
or <a role="button">
will fail the audit (because aria-required
is not supported on the "button" role).
The following roles support an aria-required
attribute:
Could you post some of the markup that seems to be failing the audit? Happy to take a closer look.
@jdan Thanks for the quick reply! You’re right, it was because the aria-required
attribute was on a checkbox. @WilcoFiers posted a possible explanation here https://github.com/dequelabs/axe-core/issues/158#issuecomment-169616271
As for checkboxes, in a way these element always provide a value (checked or unchecked). I'm guessing that when you mean to make such an element 'required' you intend for it to be checked. This is a common enough use case. The aria-required attribute does not permit a 'null' result. But a checkbox never gives null, it only gives a true or false value.
Would love suggestions for how to indicate the checkbox must be checked. Thanks!
@tedw you should bring this up in the ARIA working group. In the interim, I would suggest that you place the required text in the label of the checkbox e.g.
<label for="licenseAgreement">I agree to the license (required)</label><input type="checkbox" id="licenseAgreement"/>
Thanks, @dylanb, I'm doing that now and guess it will have to suffice. Will reach out to some folks on Twitter to see what they have to say before submitting an issue on https://github.com/w3c/aria/.
Right on. I'm going to close this for now, holler if you need anything else!
Using
aria-required
currently triggers an “unsupported ARIA attribute” warning (AX_ARIA_10
) even though it’s actually a valid attribute. https://www.w3.org/TR/wai-aria/states_and_properties#aria-required