-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add required-attribute support for fieldsets #6868
Comments
It's not clear what semantics would be for this generally. The most straightforward would be to treat it like I guess you are trying to express that one of the checkboxes is required though. Which would be a totally new capability. Specifying that seems fairly complex as you'd have to figure out how it interacts with explicit In the meantime note that you can achieve this with some JavaScript, if you are content to ignore all of the complicated cases above that a spec would have to take into account and only care about checkboxes. https://jsbin.com/nucekozegi/1/edit?html,output |
If allowing But that isn't really what this proposal (or previous proposals which have been made to ARIA) is asking for. Rather, as Domenic already mentioned, the concept of a checkbox group where a required number of checkboxes be checked (as it's not always just 1, and no specific checkbox or checkboxes are actually required) seems to be the actual ask. That would require more than just allowing Regarding the example markup, if the "(required)" text was not set to |
I've also been wondering about this and propose the following... SIMPLE VERSION: Implies that at least one field within the fieldset is valid/non-empty value according to its defined pattern. Fields within do not need a required attribute, nor are they in an error state. The fieldset itself would read back its invalidity like an input does when focus enters it. Custom error styling may work as such... fieldset:invalid input
ADVANCED VERSION: At least 2 items must have valid/non-empty values, but no more than 3 We could repurpose maxlength & minlength from inputs for fieldsets to capture the range of valid items within. Not every 'required' collection of fields are checkbox specific. For example, one of any categorized search query terms could help pre-filter a set of results. None are required, but at least one is. |
I think this is important and should be implemented |
It would be very useful to be able to use the
required
attribute to mark up content as required infieldset
. I realise that individual form elements, and groups of radio buttons can be marked up asrequired
, but there's no way to do this for groups of checkboxes, which is a gap. Here's an example use case where this would be useful:This isn't something that ARIA can be currently used to "patch", as the
group
role, which relates to thefieldset
element, doesn't supportaria-required
. Adding support forrequired
onfieldset
s would make development easier and would hopefully see the ARIA specification updated to match.The text was updated successfully, but these errors were encountered: