World’s largest virtual agentic engineering & quality conference
Learn to test form labels, required fields, and error messages for WCAG compliance, with the success criteria, code patterns, and tools to verify each.

Rahul Mishra
Author
Mayank Bhola
Reviewer
Last Updated on: July 31, 2026
A screen reader user fills out a signup form. They tab to a phone number field, submit, and hear nothing change. The page silently added a red border and the text "Invalid format" three fields away, but nothing told them an error happened at all, so they resubmit the same broken value twice before giving up.
Forms are where accessibility testing earns its keep, because a form is the one part of a product where a user must succeed to get any value out of it at all. WCAG covers this directly: 1.3.1 Info and Relationships and 3.3.2 Labels or Instructions require every field to have a programmatic label, and 3.3.1 Error Identification requires that any error be described to the user in text, not just implied by a color change. This guide walks through what makes a field accessible, how to write and wire up error messages correctly, and how to test both automatically and by hand using a WCAG-focused accessibility testing platform.
An accessible field exposes three things to assistive technology: a name, a role, and a value, exactly what WCAG 4.1.2 Name, Role, Value requires. If any one of those is missing, a screen reader either announces nothing useful or announces the wrong thing entirely.
The label has to be programmatically tied to its field, not just positioned nearby on the page. A sighted user infers the connection visually; a screen reader needs the code to state it explicitly.
<!-- Correct: label explicitly associated via for/id -->
<label for="email">Email address</label>
<input type="email" id="email" name="email" required aria-required="true">
<!-- Also correct: label wraps the input -->
<label>
Email address
<input type="email" name="email" required aria-required="true">
</label>
<!-- Incorrect: placeholder as the only label -->
<input type="email" name="email" placeholder="Email address">A red asterisk next to a label is a visual convention, not an accessible one on its own. It needs a matching signal in the code and, ideally, in the label text itself.
Note: Catch missing labels, unassociated errors, and contrast failures on every form with TestMu AI. Start free
This is where most forms fail, and it is governed by two distinct WCAG criteria that are easy to satisfy halfway and still miss the point. 3.3.1 Error Identification, Level A, requires that an error be identified and described in text. 3.3.3 Error Suggestion, Level AA, requires that the description actually tell the user how to fix it, not just that something is wrong.
<label for="password">Password</label>
<input type="password" id="password" name="password"
aria-required="true" aria-invalid="true"
aria-describedby="password-error">
<span id="password-error" role="alert">
Password must be at least 8 characters and include one number.
</span>Automated scanning catches the structural half of form accessibility reliably: missing labels, missing required attributes, and error text that exists in the DOM but is not associated with its field.
TestMu AI's accessibility testing runs these checks inside an existing Selenium, Playwright, or Cypress suite through a lambda-accessibility-scan hook, so a form's accessibility state is checked on every CI run rather than once during a manual audit. A Workflow Scan matters specifically for forms, since a static page scan run before submission never sees the error state a static scan of the empty form cannot evaluate.
// Selenium example: scan a form both before and after a failed submission
driver.get("https://www.testmuai.com/selenium-playground/input-form-demo");
driver.executeScript("lambda-accessibility-scan"); // scans the empty form
driver.findElement(By.id("submit")).click(); // submit with invalid data
driver.executeScript("lambda-accessibility-scan"); // scans the error stateFor teams whose AI coding agent maintains the test suite, our guide on using the accessibility agent skill covers the exact capability names for Selenium, Playwright, and Cypress so the agent does not have to guess. For functional form test coverage beyond accessibility, meaning conditional fields, file uploads, and validation logic, see our guide on testing forms without code.
Automation confirms the markup is correct. Only a real screen reader confirms the experience actually works, since the two questions are not the same.
If screen reader testing is new to your team, our accessibility testing hub covers the DevTools and screen reader workflow in more depth before you start on forms specifically.
The WebAIM Million 2026 report, an annual automated analysis of the top 1,000,000 home pages, found that 33.1 percent of form inputs were not properly labeled, making it the most common form-specific violation the study tracks. The failures behind that number repeat across almost every audit:
Start with the form your users complain about most, run an automated scan against both its empty and error states, and fix every unlabeled field and unassociated error message it finds. Then walk the same form with a keyboard and a screen reader, since that is the only way to confirm an error is actually announced the moment it appears, not just present somewhere in the markup.
To wire these checks into a suite you already run, see the accessibility automation documentation, and for the broader compliance picture beyond forms, our guide to running a WCAG audit covers a full-site pass.
Note: AI assistance was used in researching and drafting this article. Rahul Mishra (Lead Member of Technical Staff at TestMu AI, expertise in accessibility testing and WCAG compliance) verified every WCAG success criterion and code pattern against primary sources before publication, following our editorial process and AI use policy. Sources cited are from primary standards bodies, the W3C's WCAG success criteria documentation and WebAIM.
Author
Rahul Mishra is a Lead Member of Technical Staff at TestMu AI (formerly LambdaTest), leading frontend engineering and accessibility testing across the quality engineering platform. He mentors frontend engineers, runs code reviews and sprint planning, optimizes React.js rendering performance, and makes product features accessible to users with disabilities through WCAG and ADA-compliant accessibility audits. He brings 10+ years of experience across React.js, VueJS, TypeScript, Swift, Objective-C, and AWS, with earlier work as a Technical Lead at VectoScalar Technologies. Rahul holds a B.E. in Information Technology.
Reviewer
Mayank Bhola is Co-Founder and Head of Products at TestMu AI (formerly LambdaTest), where he leads the entire product portfolio across KaneAI, Kane CLI, HyperExecute, SmartUI, the Real Device Cloud, Accessibility, and other software testing product lines. As an early Lead Architect he designed and built the company's flagship Tunnel technology from scratch, created the React-based automation platform, and architected the data-intensive pipelines and FAAS services that scale it. He brings more than 10 years of experience in software development and product engineering, with earlier roles as Head of Technology at Juggernaut Books and Senior Software Engineer at PressPlay TV and Zomato. Mayank holds a B.Tech in Computer Engineering from JIIT Noida.
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance