-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
[5.x] Improve form field accessibility #10993
[5.x] Improve form field accessibility #10993
Conversation
This looks awesome! 😄 |
Ready for review 🥬 |
This is great, thanks. But just checking again about the changes in fields.antlers.html... Since we don't seem to actually use that file anywhere, the user is responsible for making their field loop look like that in their own template. Right? Nothing will magically work - e.g. the aria-described-by doesn't link to anything unless they do it themselves. Like you said, we can use that as a basic for the docs, or maybe in the future we can actually make it automatic. |
@jasonvarga Right, seems like there‘s no automatic way of upgrading all forms to make use of the proposed updates. Users will need to update their loops as well. Is it possible though that people are already using the |
Actually, yes. That's a great idea too. Instead of the whole -{{ fields }}
- ...
-{{ /fields }}
+{{ partial:statamic::forms.fields }} |
There's a few requirements for accessible forms that make sense for built-in form fields. We just did at a11y audit on a client project and I figure I'd share what we learned with while the memory is fresh :)
A good primer on accessible forms best practices is Anatomy of Accessible Forms on deque. There's also a great summary about validation and marking invalid inputs in Contextual Form Errors and ARIA.
Partially closes statamic/ideas#1069
Changes
id
andfor
attributesRequired
label for screen readersaria-describedby
aria-describedby
aria-invalid
Next steps
There's two other things that make sense to tackle, but possibly in another PR to keep this one somewhat contained:
Before
After