-
Notifications
You must be signed in to change notification settings - Fork 257
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
How can you use aria-required with checkboxes? #1963
Comments
There's a useful blog post on accessible validation of checkbox and radio button groups from 2019 that covers this and suggests using |
@fstrr, thanks for the response. While some of the test results with screen readers are interesting, this article didn't really provide me with new information entirely relevant. (They also neglected to mention/investigate live regions.) Ultimately, they spend little time talking about required fields in checkboxes and focus more on instructions/errors. They do repeat my basic issue:
I'm still left with the basic questions:
|
@mbgower Sorry it wasn't more useful. I did raise an issue on the ARIA repo yesterday, but it got almost-instantly closed with a comment that this really needs to be part of the HTML spec. So now I'm going to do that. None of this solves your problem, unfortunately. |
not had time to test, but ... add |
related, looking at the actual HTML spec, that second example is...very bizarre https://html.spec.whatwg.org/multipage/input.html#attr-input-required - if i understand it correctly, it's saying that if any radio input in a group is set to required, the whole group becomes required? |
@patrickhlauke main goal is to understand how checkboxes are intended to work with respect to aria. I get how radio buttons work. |
ah sorry, somehow i completely misread your question / replaced it in my mind with radio buttons. but fundamentally yes, the concept of "at least one checkbox in this group must be checked" doesn't seem to exist in HTML, and i'm not sure it's something that is exposed in a sensible/standardised way to the accessibility API. |
Because you ask here and not at ARIA, I give a WCAG answer (the ARIA answer would be: unfortunately not possible): SC 1.3.1:
Since required cannot be transmitted programmatically, it must be in text form. I.e. a correct solution would be to use an asterisk (*) in the |
See whatwg/html#6868 |
This issue looks like it can be closed. If it needs to be re-opened, please do that and convert it to a Discussion. |
I'm trying to provide guidance on checkboxes, and am wondering what to tell people about use of
aria-required
.It is an allowed state, according to aria. However, since checkboxes are independent on one another, how can it be applied? The only case I can think of is a with a single checkbox ("I agree") where the user must select to continue. Is that the intended use case?
One approach I'd considered was its use on a group of checkboxes. If at least one checkbox in a set must be selected, I would have thought putting aria-required on the fieldset would be an approach; however, aria is specific that while
radiogroup
can take aria-required,group
is not listed. Andfieldset
is also not showing up under the Used in Roles section.I welcome comments.
PS If this is better posted on another project, please let me know
The text was updated successfully, but these errors were encountered: