Forms are where users give you money, data, and trust. They are also where most websites fail accessibility. A form that looks clean but cannot be used by a screen reader or a keyboard excludes people and loses conversions.
You do not need a heavy component library to build accessible forms. Native HTML, a few ARIA attributes, and disciplined focus management cover most cases. Here is how to do it in 2026.
Start with Native HTML
The browser gives you accessibility for free when you use the right elements. Do not rebuild form controls with divs and spans.
Use the correct input type.
<label for="email">Email address</label>
<input type="email" id="email" name="email">
<label for="password">Password</label>
<input type="password" id="password" name="password">
<label for="website">Website</label>
<input type="url" id="website" name="website">
Screen readers announce the input type. Mobile keyboards adapt. Browsers validate email and URL formats natively. A div with a click handler does none of this.
Always pair a label with its input.
Use the for attribute on the label and match it to the input id. Do not wrap the input inside the label unless you have a specific reason. The explicit for/id relationship is the most reliable pattern across screen readers.
<label for="name">Full name</label>
<input type="text" id="name" name="name">
If you must hide the label visually, do not use display: none. That removes it from the accessibility tree. Use a visually hidden class instead.
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
Group related inputs with fieldset and legend.
Radio buttons and checkboxes that belong together need a grouping container. Without it, screen reader users hear individual options without knowing what question they answer.
<fieldset>
<legend>Account type</legend>
<label>
<input type="radio" name="account" value="personal"> Personal
</label>
<label>
<input type="radio" name="account" value="business"> Business
</label>
</fieldset>
Required and Invalid States
Native HTML validation is a start, but screen readers need explicit announcements.
Mark required fields.
Use the required attribute. Screen readers typically announce "required" when they reach the field.
<label for="email">Email address <span aria-hidden="true">*</span></label>
<input type="email" id="email" name="email" required>
The aria-hidden="true" on the asterisk prevents screen readers from saying "star" or "asterisk" while keeping the visual cue for sighted users.
Announce errors clearly.
When a form submission fails, move focus to the first invalid field and announce the error.
<label for="email">Email address</label>
<input type="email" id="email" name="email" required aria-invalid="true" aria-describedby="email-error">
<span id="email-error" role="alert">Please enter a valid email address.</span>
Key attributes:
aria-invalid="true"tells the screen reader the field contains an error.aria-describedbylinks the input to the error message.role="alert"on the error message forces an immediate announcement.
Do not rely on color alone. A red border means nothing to a user who cannot see it. Pair color with text and icons.
Focus Management
Keyboard users navigate with the Tab key. Your form must respect that order.
Preserve natural tab order.
Do not use tabindex values greater than zero. They break the expected sequence. If your HTML is structured logically, the default tab order works.
Make focus visible.
Never remove the focus outline without replacing it. Browser default outlines vary, but a custom focus style ensures visibility across browsers.
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
outline: 3px solid #0066cc;
outline-offset: 2px;
}
:focus-visible is better than :focus because it shows the outline for keyboard users but not for mouse users who click a field.
Manage focus after dynamic changes.
If a form submission shows a success message, move focus to that message. If a modal opens, trap focus inside it. If an error appears, move focus to the error summary or the first invalid field.
const errorSummary = document.getElementById('form-errors');
if (errorSummary) {
errorSummary.focus();
}
Do not steal focus unexpectedly. Only move focus when the user initiates an action or when a critical state change requires immediate attention.
Complex Patterns
Some form controls need extra care.
Custom selects.
Native <select> elements are accessible by default. If you build a custom select with divs, you must manage keyboard navigation, ARIA roles, and focus yourself. That is easy to get wrong.
Prefer the native element. Style it with CSS where possible. If you must build a custom select, use role="combobox", aria-expanded, aria-activedescendant, and handle arrow key navigation.
Date pickers.
A native <input type="date"> is accessible and localized by the browser. Custom date pickers require keyboard navigation through the grid, clear announcement of the selected date, and focus trapping. Unless you have specific design requirements, use the native input.
File uploads.
Native <input type="file"> works with screen readers. If you style it with a custom button, visually hide the input but keep it in the tab order, and link it to the visible button with aria-labelledby.
<label for="file-upload" class="file-button">Choose file</label>
<input type="file" id="file-upload" class="sr-only">
Screen Reader Testing
Code is not enough. You must test with actual assistive technology.
NVDA (Windows, free).
Install NVDA. Turn on speech viewer so you can see what is announced. Tab through your form. Listen for:
- Label announcements on each input.
- Required state announcements.
- Error messages when they appear.
- Group legends for fieldsets.
VoiceOver (macOS and iOS, built-in).
Press Command-F5 to enable VoiceOver. Use Control-Option to navigate. On iOS, use the rotor to jump between form controls. Test on both desktop and mobile.
JAWS (Windows, commercial).
The industry standard in many corporate and government environments. If your users include government employees or accessibility professionals, JAWS testing matters.
What to listen for.
- Does the screen reader announce the label when the input receives focus?
- Does it announce required fields?
- Does it announce errors immediately when they appear?
- Can you complete and submit the form without a mouse?
If the answer to any of these is no, your form is not accessible.
Common Mistakes
Placeholder is not a label.
Placeholder text disappears when the user types. Screen readers may or may not announce it. Never use placeholder as a substitute for a visible label.
<!-- Bad -->
<input type="text" placeholder="Full name">
<!-- Good -->
<label for="name">Full name</label>
<input type="text" id="name" name="name">
Divs as buttons.
A div with a click handler is not a button. It is not in the tab order. Screen readers do not announce it as activatable. Use <button type="button"> or <button type="submit">.
Missing legends.
A fieldset without a legend announces as a group with no name. Screen reader users hear a series of unlabeled options. Always include a legend.
Low contrast error text.
Red error text on a white background may fail contrast requirements. Test with a contrast checker. Text should meet at least 4.5:1 against its background.
Testing Checklist
Before you ship a form, verify:
- Every input has a visible label.
- Every label is programmatically associated with its input.
- Required fields have the
requiredattribute. - Error messages use
aria-invalidandaria-describedby. - Focus is visible on all interactive elements.
- Tab order follows the visual layout.
- Fieldsets have legends for grouped inputs.
- Form submission moves focus to confirmation or first error.
- The form can be completed and submitted using only a keyboard.
- Screen readers announce labels, required states, and errors.
What This Means for Your Product
Accessible forms are not an edge case. They are a conversion issue. A user who cannot complete your sign-up form does not become a customer. A user who cannot submit a contact form does not become a lead.
You do not need a heavy framework to build accessible forms. You need native HTML, correct ARIA attributes, visible focus styles, and the discipline to test with a screen reader. Build it once, build it right, and every user benefits.