Yesterday, I highlighted the 2025 Web Almanac section on forms where the numbers showed some small improvements. But the Almanac is quite limited in what it can measure. And one thing it cannot accurately cope with is form errors.
When you fill out a form and hit submit, what happens if you made a mistake? Do you know what went wrong? Do you know where the error is? Can you go in and fix it? Are there any suggestions on how to fix it?
The Web Almanac's accessibility chapter focuses on what can be measured through automated crawling of millions of pages. They can detect whether a <label> element exists. They can count placeholder attributes. They can check if buttons have accessible names.
But error handling is inherently interactive.
They can't measure it without actually submitting forms with both valid and invalid data. They'd need to identify required fields, understand validation rules, trigger errors deliberately and then analyse the results. And that's not something you can do at scale with a crawler.
So it's down to us to do these checks manually.
For many users, especially those using screen readers, poor error handling can make or break a form. A red border around a field means nothing to a screen reader user. An error message at the top of a long form is useless if there's no programmatic link to the problem fields. And telling them "Invalid input" without any explanation is just cruel.
Here are five ways to make sure you're not being cruel:
- Submit forms with intentional errors. Don't just test the happy path. Make some intentional mistakes and see what happens.
- Use a screen reader to work with the errors. How are the errors announced? Do you immediately know something's wrong? Can you find the problems? Are the error messages helpful?
- Look for inline error messages. Do errors appear near the relevant fields or is it just in a summary at the top?
- Check error messages are specific. "Invalid input" is terrible. "This field is required" is okay. "Password must be at least 8 characters" is useful. Error messages should tell users exactly how to fix the problem.
- Try to fix the errors with just a keyboard. After submitting a form with errors, does focus move somewhere helpful? Can you navigate to the problem fields easily? Or are you dumped back at the top of the page with no idea where something went wrong?
Funny story time.
Some time ago, I was working on a rather complex form as part of an accessibility audit. All the fields had really helpful hint text. I could move around easily with a keyboard and everything was wired up correctly. With all fields filled in correctly, the form submitted without any issues.
Next came testing the errors. I made mistakes in most fields, on purpose. I pressed Submit. Boom! "Undefined error!!!" in a popup. Yes, with three exclamation marks.
Okay, maybe I tried overloading the form with errors. I narrowed it down to just one field with an error - an incorrectly formatted date. Press Submit. That worked. Error nicely shown inline with suggestions.
Through trial and error, I figured out that you could have too many errors. Because the moment I made too many, the system didn't cope. I think the back-end was so spectacularly broken that even the error handler was giving up.
And that my friend is why accessibility isn't just the front-end's responsibility.