-
Notifications
You must be signed in to change notification settings - Fork 105
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
Field errors and description #120
Comments
Thanks for the question. My knowledge on accessibility topic is quite limited, so the main reason I go for But what you suggested sounds fair to me too. How about putting both id on
|
I'm no accessibility export, so this is something I'm unsure about (didn't even think about checking support for One thing I came across trying to read up on the topic, it looks like some only include the "errorId" in |
I got the same question as you. It was tempting to not provide the extra I couldn't find much information on this topic except this question on stackoverflow. I think I am convinced it's always a good idea to ensure the HTML to be semantically correct. As I could not guarantee the error element to be always rendered (i.e. there is no element with the errorId when no error), it seems better to add the errorId only if there is an actual error. Like this: <input {...conform.input(email, { type: "email" })} />
// If valid, no aria attributes will be set
// If invalid, aria-invalid="true" aria-describedby="errorId"
<input {...conform.input(email, { type: "email", description: true })} />
// If valid, aria-describedby="descriptionId"
// If invalid, aria-invalid="true" aria-describedby="errorId descriptionId" |
Based on that stackoverflow post this looks perfect! |
This is now supported on v0.6.1 🚀 |
Love that conform handle errors for me in an accessible way. But one question, should it use
aria-errormessage
instead ofaria-describedby
?I would also like to have conform handle field descriptions for me. Adding
aria-describedby
with a unique id ifdescription
is set totrue
. Maybe the api could look something like this:The text was updated successfully, but these errors were encountered: