Skip to content
Rittick DattaFULL STACK DEVELOPER

2026-11-15 · 17 min read

Website Accessibility: A Practical Guide for Developers

Learn why website accessibility matters, who benefits from it, and how to build inclusive web experiences using semantic HTML, keyboard navigation, ARIA, WCAG guidelines, and accessibility testing tools like axe-core.

Website Accessibility: Building for Everyone — inclusive design, keyboard access, and accessible forms

Imagine trying to book a train ticket online without using a mouse. You can see the departure time and the Book now button, but pressing Tab never reaches it. Or imagine an error message that says “Invalid input” in red, but doesn't tell you which field needs fixing.

For some people, these are occasional frustrations. For others, they make the entire website unusable.

Web accessibility (often abbreviated as a11y) means designing and building websites that people with different abilities, devices, and ways of interacting can actually use. It is not an optional visual polish step. It is part of making software work.

In this guide, we'll start with real people and everyday examples, then move into HTML, React, testing tools, and a detailed checklist you can use before shipping.

1. What is website accessibility?

An accessible website lets people perceive information, navigate the interface, understand what is happening, and complete their tasks—including when they use assistive technology or cannot use the website in the way its designers initially imagined.

Accessibility is not the same as usability, although the two overlap. A beautiful interface might be usable with a mouse and still be impossible to operate with a keyboard. Conversely, technically correct labels do not guarantee that instructions are understandable.

A useful starting point is the Web Content Accessibility Guidelines (WCAG), developed by the W3C. WCAG 2.2 organizes accessibility around four principles, often remembered as POUR:

  1. Perceivable: People can access the information, such as text alternatives for meaningful images and captions for video.
  2. Operable: People can use controls, including with a keyboard and without time pressure where possible.
  3. Understandable: Labels, instructions, navigation, and errors make sense.
  4. Robust: Content works reliably with browsers and assistive technologies.

For most product teams, WCAG 2.2 Level AA is a practical engineering target. Level A, AA, and AAA describe sets of testable success criteria; AA is not a promise that every person's needs have been met.

The question isn't “Does this page look accessible?” It is “Can someone using a keyboard, screen reader, zoom, captions, or voice control finish the same important tasks?”

2. Why accessibility matters

  • Equal access: A person should not be excluded from applying for a job, buying a product, or accessing healthcare because of an interface barrier.
  • Better product quality: Clear labels, logical navigation, readable text, and predictable error messages improve the experience for many people.
  • Broader reach: People use different devices, input methods, languages, and environments.
  • Reduced rework: Accessibility built into shared components is cheaper to maintain than fixing hundreds of screens later.
  • Compliance: Accessibility requirements may apply depending on your country, industry, customer contracts, and organization. Check the rules relevant to your product rather than assuming one universal law.

Accessibility also helps people in temporary or situational circumstances: a broken arm, a noisy bus, a bright outdoor screen, or a phone used with one hand.

3. Who needs an accessible website?

Examples of users with visual, hearing, mobility, cognitive, and situational accessibility needs

People with visual disabilities

Someone who is blind may use a screen reader such as NVDA, VoiceOver, or JAWS. They need meaningful headings, labeled buttons, descriptive links, and sensible reading order. Someone with low vision may enlarge the page to 200% or more and needs content that doesn't disappear or overlap.

Example: A checkout button with only a shopping-cart icon needs an accessible name, such as aria-label="Checkout", unless visible text already names it.

People with mobility or dexterity disabilities

Some people cannot reliably use a mouse or precise touch gestures. They may navigate using a keyboard, switch device, voice input, or other assistive technology.

Example: A menu that only opens on mouse hover blocks keyboard-only users. It must also be operable by keyboard and expose its expanded state.

People who are Deaf or hard of hearing

Audio-only instructions and videos without captions can exclude people. Provide accurate captions for spoken dialogue and meaningful sounds; provide transcripts when appropriate, especially for audio-only material.

Example: An onboarding video should not be the only place where the steps to activate an account are explained.

People with cognitive, learning, or neurological disabilities

Complex wording, inconsistent navigation, unexpected movement, and unclear form errors can make tasks harder. Clear structure, plain language, predictable interactions, and the ability to correct mistakes help.

Example: “Your password must include at least 12 characters” is more useful than “Password invalid.”

People with temporary or situational needs

A person with a sprained wrist, a commuter in a noisy environment, or someone using a phone in bright sunlight can benefit from the same design decisions.

Key lesson: Don't design for a single “average user.” Design for different ways of perceiving, understanding, and operating the interface.

4. What developers should focus on first

Core developer practices: semantic HTML, keyboard navigation, focus, readable text, contrast, and accessible forms

4.1 Prefer semantic HTML before ARIA

HTML already communicates a lot of useful meaning to browsers and assistive technologies. Use <button> for an action, <a> for navigation, <nav> for navigation regions, and <main> for the primary page content.

Avoid:

<div onClick={submitForm}>Submit</div>

Prefer:

<button type="submit">Submit</button>

The native button supports keyboard activation and exposes button semantics automatically. Recreating all of that with a div takes additional code and is easy to get wrong.

Use a meaningful heading hierarchy (h1 followed by appropriately nested h2 and h3 sections), a descriptive document title, a declared page language, and landmarks such as header, nav, main, and footer.

Rule of thumb: Use native HTML first; use ARIA when native HTML cannot express the necessary state or behavior. ARIA does not automatically add keyboard interaction.

4.2 Make every important interaction work with a keyboard

Try navigating your site using only:

  • Tab and Shift + Tab to move through interactive elements.
  • Enter or Space to activate controls, as appropriate.
  • Arrow keys for widgets that follow established keyboard patterns.
  • Escape to dismiss a modal or menu where expected.

Focus must be visible. Do not remove the focus outline without providing an equally clear replacement.

:focus-visible {
  outline: 3px solid #6d28d9;
  outline-offset: 3px;
}

Also make sure sticky headers, dialogs, and overlays do not hide the currently focused element. WCAG 2.2 includes Focus Not Obscured (Minimum) at Level AA.

4.3 Build forms that explain themselves

Every input needs a programmatic label. Placeholder text alone is not a reliable substitute for a label. Connect instructions and errors to the field they describe.

function EmailField({ error }) {
  return (
    <div>
      <label htmlFor="email">Email address</label>
      <input
        id="email"
        name="email"
        type="email"
        autoComplete="email"
        aria-invalid={Boolean(error)}
        aria-describedby={error ? 'email-error' : undefined}
      />
      {error && <p id="email-error">{error}</p>}
    </div>
  );
}

For a full form, identify required fields, give actionable errors, preserve entered data when validation fails, and move focus or announce a summary when appropriate so users can find the errors. For sensitive or consequential submissions, provide opportunities to review, correct, or confirm information.

4.4 Write useful alternative text

Alt text communicates the purpose of an image in its context, not necessarily every visible detail.

<img
  src="sales-chart.png"
  alt="Sales rose steadily from January to June"
/>

If a chart communicates exact values, also provide the data in text or a table. Decorative images should usually use alt="" so they do not add noise for screen-reader users. Don't write “image of” unless that distinction matters.

4.5 Make text readable and layouts adaptable

  • For WCAG AA, aim for at least 4.5:1 contrast for normal text and 3:1 for large text, subject to the standard's exceptions.
  • Do not communicate status using color alone: pair a red error border with text and an icon or another clear cue.
  • Allow text to resize and the layout to reflow without losing information or functionality.
  • Use readable line lengths, spacing, and plain language.
  • Ensure controls are large enough and spaced adequately for touch and pointer use. WCAG 2.2 includes a 24 × 24 CSS pixel minimum target-size criterion at AA, with specific exceptions.
  • Respect reduced-motion preferences for nonessential animations.
@media (prefers-reduced-motion: reduce) {
  .decorative-animation {
    animation: none;
    transition: none;
  }
}

4.6 Treat dialogs, dropdowns, and dynamic updates carefully

A modal needs an accessible name, sensible initial focus, contained keyboard focus while open, and focus returned appropriately when it closes. Menus, tabs, comboboxes, and accordions each have expected interaction patterns; consult the WAI-ARIA Authoring Practices Guide rather than improvising.

When a page updates without navigation, screen-reader users may need to be notified of important status changes. For simple messages, a live region can help:

<p
  role="status"
  aria-live="polite"
>
  {saveMessage}
</p>

Don't announce every tiny change. Too many announcements can be as disruptive as none.

5. Tools and packages: what should you use?

Accessibility testing tools including axe-core, Lighthouse, browser checks, and assistive technology testing

There is no single package that can guarantee an accessible website. Use automated checks to catch detectable failures, then manually verify actual tasks and interactions.

ToolBest useLimitation
axe-coreCore automated accessibility rules engineCannot judge every interaction or content decision
@axe-core/playwrightRun axe checks in browser end-to-end testsMust test relevant routes and UI states
jest-axeCatch accessibility issues in rendered component testsA simulated DOM cannot replace real-browser testing
@axe-core/reactDeveloper feedback in React applicationsDevelopment-time feedback, not a release certification
axe DevTools / browser extensionsQuick interactive scans and inspectionResults depend on the current page state
LighthouseFast broad accessibility audit alongside other quality metricsA score does not prove conformance
eslint-plugin-jsx-a11yCatch common JSX accessibility mistakes while codingStatic analysis cannot verify runtime behavior
NVDA, VoiceOver, JAWSTest real assistive technology behaviorRequires practice and realistic user journeys

Example: test a page with Playwright and axe

Install the testing package in a project that already uses Playwright:

npm install --save-dev @axe-core/playwright

Then add a test:

import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test('checkout has no automatically detectable violations', async ({
  page,
}) => {
  await page.goto('/checkout');

  const results = await new AxeBuilder({ page })
    .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'])
    .analyze();

  expect(results.violations).toEqual([]);
});

Important: A passing test means no violations were detected by the rules that ran in that state. It does not mean the page fully conforms to WCAG. Also test the form with validation errors, open dialogs, expanded menus, and successful submission states.

Example: test a React component with jest-axe

npm install --save-dev jest-axe @testing-library/react
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
import { EmailField } from './EmailField';

test('email field has no detected accessibility violations', async () => {
  const { container } = render(<EmailField error={null} />);
  const results = await axe(container);
  expect(results.violations).toHaveLength(0);
});

Your test runner and JSX configuration may require small adjustments. Component tests are especially useful for a shared design system, but a component can pass in isolation and still become inaccessible in a larger page.

A sensible testing pyramid

  1. During coding: semantic HTML, linting, accessible component patterns.
  2. In pull requests: component tests and automated checks on important routes.
  3. Before release: manual keyboard tests, zoom/reflow checks, and screen-reader walkthroughs.
  4. After release: monitor regressions and collect feedback from people with disabilities.

6. A real example: making a checkout flow accessible

Imagine a commerce site with a product page, cart, delivery form, and payment confirmation.

Problem 1: The cart icon has no name. A screen reader announces “button” without explaining what it does. Fix it with visible text or a meaningful accessible name.

Problem 2: The address form uses placeholders instead of labels. Users lose the field's purpose when they start typing. Add persistent labels and relevant autocomplete values.

Problem 3: Errors only appear in red. Users may miss the issue or be unable to identify the field. Add explicit error text, connect it with aria-describedby, and make errors discoverable after submission.

Problem 4: The payment dialog traps the user incorrectly. Keyboard focus disappears behind the overlay. Implement the established dialog pattern, manage focus correctly, and provide a clear close action.

Problem 5: The order success message appears silently. Users relying on assistive technology may not know the order completed. Move focus to the confirmation heading when navigating to a new confirmation view, or announce a meaningful status update for an in-place change.

The goal is not just to pass a scanner. The goal is to let someone find a product, complete payment, and understand the result independently.

7. Thorough website accessibility checklist

Website accessibility review checklist covering semantics, keyboard use, media, visual design, forms, and testing

Use this as a release checklist for each meaningful page template and critical user journey. It is a practical starting point, not a replacement for the full WCAG success criteria.

A. Document structure and navigation

  • Every page has a unique, descriptive <title> and a correct lang attribute.
  • Headings describe content and follow a logical hierarchy.
  • Use semantic regions such as header, nav, main, and footer.
  • Provide a working skip-to-main-content link when repeated navigation exists.
  • Link text makes sense out of context; avoid ambiguous “click here” links.
  • Navigation order and labels are consistent across related pages.
  • The reading order makes sense when styles are removed or layouts change.
  • Changes of language within content are identified when necessary.

B. Keyboard and focus

  • All important functionality works without a mouse.
  • Tab order follows the intended reading and interaction sequence.
  • Keyboard focus is always visible and not obscured by sticky UI.
  • No keyboard traps exist; users can enter and leave widgets.
  • Dialogs, menus, tabs, and comboboxes follow appropriate keyboard patterns.
  • Focus moves sensibly after navigation, dialog opening/closing, and major updates.
  • Hover-only content is also available through keyboard focus where required.
  • Drag-only interactions have an alternative that does not require dragging.

C. Visual presentation

  • Normal text meets the applicable contrast requirement (usually 4.5:1 for AA).
  • Large text meets the applicable contrast requirement (usually 3:1 for AA).
  • Essential non-text UI indicators meet applicable contrast requirements.
  • Meaning is never conveyed by color alone.
  • Text can be enlarged and content reflows without losing functionality.
  • The interface works in portrait and landscape where orientation is not essential.
  • Target sizes and spacing meet applicable WCAG requirements or exceptions.
  • Animations do not flash dangerously; nonessential motion can be reduced.
  • Text remains readable with increased spacing and on small screens.

D. Images, audio, and video

  • Meaningful images have useful alternative text.
  • Decorative images use empty alt text where appropriate.
  • Charts have accessible summaries and underlying data when needed.
  • Prerecorded videos have accurate captions when required.
  • Audio-only content has a suitable transcript or equivalent alternative.
  • Important visual-only information in video has an accessible alternative where required.
  • Media controls are keyboard accessible and clearly labeled.
  • Content does not autoplay disruptive audio without a way to stop or control it.

E. Forms and user input

  • Every form control has a persistent, programmatic accessible name.
  • Required fields and formats are clearly explained.
  • Input purpose uses supported autocomplete tokens when applicable.
  • Errors identify the affected field and explain how to fix it.
  • Error text is associated with the relevant input.
  • Focus or announcements make submission errors discoverable.
  • Status messages are announced appropriately without stealing focus unnecessarily.
  • Authentication does not depend solely on inaccessible memory or puzzle tasks.
  • Important submissions allow review, correction, or confirmation where required.
  • Users are not asked to re-enter information unnecessarily in the same process, subject to applicable exceptions.

F. Dynamic interfaces and assistive technology

  • Custom controls expose the correct role, name, value, and state.
  • Expanded/collapsed, selected, checked, and disabled states are communicated correctly.
  • Dialogs have names and correct focus behavior.
  • Dynamic updates and loading states are communicated when necessary.
  • Accessible names match visible labels where relevant for speech input.
  • Screen-reader users can identify landmarks, headings, controls, and errors.
  • A full critical journey is tested with at least one screen reader/browser combination.

G. Testing and team process

  • Run automated axe checks on key pages and important interactive states.
  • Run keyboard-only walkthroughs of critical user journeys.
  • Test at high zoom and narrow viewport widths.
  • Test contrast, reduced motion, and relevant system accessibility settings.
  • Review new shared components before broad reuse.
  • Include accessibility acceptance criteria in tickets and pull requests.
  • Track known barriers with owners, severity, and remediation dates.
  • Include people with disabilities in usability testing where feasible.
  • Re-test after design-system changes, major releases, and third-party integrations.

8. What should a team prioritize?

If your product has existing accessibility issues, don't try to fix every screen randomly. Prioritize based on user impact:

  1. Critical journeys first: sign-in, registration, checkout, booking, account recovery, and key workflows.
  2. Blockers before polish: keyboard traps, unlabeled primary actions, inaccessible forms, and unreadable content.
  3. Shared components next: fixing one dialog, button, or form component can improve many pages.
  4. Automate repeatable checks: prevent regressions through CI, linting, and tests.
  5. Keep testing with humans: especially when workflows are complex or business-critical.

For a new product, bake accessibility into design-system foundations, component definitions, design reviews, and definition-of-done criteria from the beginning.

9. Final thoughts

Accessibility isn't a plugin you install at the end of a project. It is a way of thinking about the people who will use what you build.

Start with semantic HTML. Make the interface work with a keyboard. Label controls clearly. Write helpful errors. Test with axe and real assistive technologies. Then keep improving as your product evolves.

A website is only truly useful when people can complete what they came to do.

Further reading