All topics
Formsintermediate

Accessible Form Design

Learn the accessibility fundamentals every React form should implement: labels, error announcements, and keyboard support.

An accessible form ensures every input has a properly associated <label> (via matching htmlFor/id, or by wrapping the input inside the label element), so screen reader users hear a clear description of what each field expects rather than just 'edit text' with no context. Placeholder text alone is not an adequate substitute for a label, since it disappears once the user starts typing and isn't reliably announced the same way by assistive technology.

Accessible form markup is like clear signage and tactile guidance in a public building for visitors who can't rely on visual cues alone — a label is the sign identifying what a room is for, aria-describedby and aria-live are like an announcement system proactively telling someone about a change (like a room being temporarily closed) rather than expecting them to notice a posted sign on their own.

Key Concepts

1
Validation errors need to be both visually associated with their field (commonly via aria-describedby pointing at the error message's id) and programmatically announced when they appear, often using an aria-live region so a screen reader user is notified of a new error without needing to manually navigate to find it. aria-invalid="true" on the input itself signals its current invalid state to assistive technology.
aria-describedbyidaria-livearia-invalid="true"
2
Keyboard support matters just as much as screen reader support: every interactive form element must be reachable and operable via keyboard alone (native <input>, <select>, and <button> elements get this for free, but custom-built controls like a styled dropdown need deliberate focus management and keyboard event handling to match). Focus should also move sensibly after an action — for example, moving focus to the first invalid field after a failed submission attempt.
<input><select><button>
3
Interviewers assessing accessibility awareness often ask candidates to identify what's wrong with a form that only shows error text in red without any programmatic association to its field, or that relies solely on a placeholder instead of a real label — both are common real-world accessibility failures that are easy to overlook without deliberate attention.