Back to results for “Forms”
React › Accessibility (a11y) in React

What is accessibility in React and why does it matter?

Beginner

Answer

Accessibility means building an app that everyone can use, including people who use screen readers, keyboards only, or have vision or motor difficulties. In React this means using semantic HTML elements, adding proper labels to form fields, and making sure every interactive element can be reached and used with a keyboard.
function LoginForm() {
  return (
    <form>
      <label htmlFor="email">Email</label>
      <input id="email" type="email" name="email" />
      <button type="submit">Log In</button>
    </form>
  );
}
Real-world example A banking website adds proper labels and keyboard support to every form so that a visually impaired customer using a screen reader can open an account without needing help from anyone else.

Common follow-ups: What happens if a form input has no label at all?;How do you test a React app for accessibility issues?