Skip to content
ISSUE 12.04.26/24 CATEGORIES

Web Accessibility Guide 2026 — WCAG, ARIA, Testing Tools

Web Development·35 min read·May 14, 2026
Editorial TeamPublished May 14, 2026Updated October 21, 202635 min read
Close-up of a weathered handicap sign painted on a pavement, emphasizing accessibility.

Photo: Jakub Pabis / Pexels

Web accessibility means building pages that people can perceive, operate, and understand with a keyboard, a screen reader, voice control, or magnification, not just a mouse and good eyesight. WCAG 2.2, published on October 5, 2023, is the working standard, and Level AA is the usual target. This guide explains what AA asks for, which HTML patterns satisfy it, where ARIA helps and where it quietly breaks things, and how to test so failures surface before your users find them.


Why web accessibility is a requirement, not an extra

The World Health Organization estimates that 1.3 billion people, about 16% of the world's population or 1 in 6, live with a significant disability (WHO fact sheet, March 7, 2023). In the United States, the CDC reports that more than 1 in 4 adults have some type of disability (CDC).

The breakdown matters for developers. The CDC lists cognition at 13.9% of adults and mobility at 12.2%, ahead of hearing (6.2%) and vision (5.5%). Accessibility is therefore not mainly a blindness problem. It is a problem of clear language, predictable layouts, forgiving forms, and interfaces that work without a precise mouse.

There is also a situational side. A parent holding a baby has one free hand. A commuter watches a video on mute. Someone with a broken wrist navigates by keyboard for six weeks. Captions, high contrast, and keyboard support help all of them, which is the strongest practical argument for building them in.

How often the web fails

The annual WebAIM Million study runs an automated scan on the home pages of the top one million sites. In its 2026 report (data collected in February 2026), 95.9% of home pages had at least one detectable WCAG 2 failure, and the average page had 56.1 errors (WebAIM Million). Six failure types account for most of the damage, and each has a short fix.

Failure Share of home pages (2026) Fix
Low contrast text 83.9% Use colors that meet 4.5:1 for normal text
Missing alternative text 53.1% Give every image an alt attribute
Missing form input labels 51% Associate a <label> with every control
Empty links 46.3% Give each link visible or accessible text
Empty buttons 30.6% Give each button a text name
Missing document language 13.5% Set <html lang="en">

Source: WebAIM Million 2026.

None of these requires specialist knowledge. They are HTML hygiene, which is why the rest of this guide spends so much time on plain markup.

The legal picture

Accessibility rules differ by country and by who you are. Two frameworks show how the landscape is moving. This is a summary of public information, not legal advice.

Rule Who it covers Standard Key dates
ADA Title II web rule (US Department of Justice) State and local governments WCAG 2.1 Level AA Published April 2024. After an Interim Final Rule in April 2026: April 26, 2027 for entities serving 50,000 or more people, April 26, 2028 for smaller entities and special districts
European Accessibility Act (EU Directive 2019/882) Products and services such as e-commerce, banking, e-books, and passenger transport Technical standards that reference WCAG Member states had to transpose it by June 28, 2022. Requirements apply to newly marketed products and services from June 28, 2025

Sources: ADA.gov, European Commission, and a summary of the Act's application dates and microenterprise exemption.

The ADA rule above applies to governments. Obligations for private businesses and for services sold into the EU depend on size, sector, and jurisdiction, and a lawyer should answer those questions. As a design target, WCAG 2.2 AA satisfies the 2.1 AA level that these rules cite, apart from one criterion that WCAG 2.2 dropped (covered below).


WCAG in plain terms: four principles, three levels

WCAG (Web Content Accessibility Guidelines) is the standard published by the W3C's Web Accessibility Initiative. It is written as testable statements called success criteria. Each criterion has a level, and the levels work like tiers in a building code.

  • Level A is the floor: the doors exist and can be opened. Missing alt text and keyboard traps fail here.
  • Level AA is the practical standard: the doors are wide enough for a wheelchair and clearly marked. Contrast ratios and visible focus live here. Most laws and procurement rules point to AA.
  • Level AAA is aspirational: every feature is accommodated for every user. Few sites meet all of it, and the W3C does not recommend requiring AAA across a whole site because some criteria cannot be satisfied for all content.

Target WCAG 2.2 AA and pick up AAA items where they are cheap.

The four principles (POUR)

Criteria are grouped under four principles, usually remembered as POUR.

Principle The question it asks Typical requirements
Perceivable Can users take in the content with the senses they have? Text alternatives, captions, sufficient contrast, text that can be resized
Operable Can users work the interface with the tools they have? Full keyboard access, enough time, no seizure triggers, clear navigation
Understandable Can users follow the content and predict the behavior? Readable text, consistent navigation, help with errors
Robust Does it work with current and future assistive technology? Correct names, roles, and states exposed to the browser

What changed in WCAG 2.2

WCAG 2.2 became a W3C Recommendation on October 5, 2023. It added nine success criteria and removed one, 4.1.1 Parsing, which the W3C declared obsolete (W3C: What's New in WCAG 2.2). The new criteria concentrate on touch targets, focus, and cognitive load.

Criterion Level What it asks
2.4.11 Focus Not Obscured (Minimum) AA A focused element is not entirely hidden behind sticky headers, cookie banners, or similar content
2.4.12 Focus Not Obscured (Enhanced) AAA No part of a focused element is hidden
2.4.13 Focus Appearance AAA The focus indicator meets minimum size and contrast
2.5.7 Dragging Movements AA Anything done by dragging also works with a single pointer action
2.5.8 Target Size (Minimum) AA Pointer targets are at least 24 by 24 CSS pixels, with exceptions
3.2.6 Consistent Help A Help links and contact options appear in the same place across pages
3.3.7 Redundant Entry A Users are not asked to re-enter information they already gave in the same process
3.3.8 Accessible Authentication (Minimum) AA Login does not depend on a memory or puzzle test without an alternative
3.3.9 Accessible Authentication (Enhanced) AAA Stricter version of 3.3.8

Later sections show how the AA items change real code.


Semantic HTML: the foundation

Browsers build a second tree next to the visual page called the accessibility tree. Each node carries a name, a role, and a state, and screen readers and voice control tools read that tree instead of looking at pixels. If you want to see how markup becomes the tree that assistive tools consume, our explainer on how browsers render web pages covers the pipeline.

Native HTML elements arrive with the right entries in that tree already filled in. A div arrives empty. The difference is like a wall outlet versus a drawing of an outlet: the real one delivers power, and the drawing looks the same from across the room.

Wrong

<!-- Generic divs: no role, not focusable, no keyboard activation -->
<div class="button" onclick="submit()">Submit</div>
<div class="link" onclick="navigate()">Go to home</div>

Right

<!-- Native elements: role, focus, and keyboard behavior come free -->
<button type="submit">Submit</button>
<a href="/home">Go to home</a>

What you get for free

A <button> is:

  • Focusable with Tab
  • Activated with Enter and Space
  • Announced as a button, with its text as the name
  • Stylable with :hover, :focus-visible, and :disabled

A <div> provides none of that. Adding role="button" and tabindex="0" fixes two items, but you still owe the browser the key handlers, the disabled state, and the focus styling.

The elements to know

<header> <!-- Page or section header -->
<nav> <!-- Navigation links -->
<main> <!-- The primary content, once per page -->
<article> <!-- Self-contained content -->
<section> <!-- Thematic grouping, best with a heading -->
<aside> <!-- Related, tangential content -->
<footer> <!-- Page or section footer -->
<button> <!-- Performs an action -->
<a href> <!-- Navigates somewhere -->
<ul>/<ol> <!-- Lists -->
<table> <!-- Tabular data only -->

The rule of thumb: a link goes somewhere and a button does something. If you reach for a div, check whether one of the elements above already means what you want. The same discipline pays off outside accessibility, and our primer on HTML, CSS, and JavaScript fundamentals builds the habit from the start.


Page structure: title, language, headings, and landmarks

Before any component is built, four page-level details decide whether a screen reader user can orient themselves.

Document language. <html lang="en"> tells screen readers which pronunciation rules to use. Without it, an English page may be read with the wrong voice. WebAIM found the attribute missing on 13.5% of home pages in 2026.

Page title. Every page needs a unique <title>. It is the first thing announced when a page loads and the label in browser tabs and history.

Headings. Users who navigate by heading rely on the outline to jump between sections, much as a sighted reader scans bold text in a newspaper. Use headings for structure, never for size.

<h1>Article Title</h1>
 <h2>First Section</h2>
 <h3>Subsection</h3>
 <h3>Another subsection</h3>
 <h2>Second Section</h2>
 <h3>Subsection</h3>
<h1>Article Title</h1>
 <h2>First Section</h2>
 <h4>Subsection</h4> <!-- Skipped h3: the outline now has a hole -->
<h1>Another big text</h1> <!-- Used for size, not structure -->

Use one h1 that names the page, keep levels sequential, and control appearance with CSS.

Landmarks. header, nav, main, aside, and footer create regions that assistive technology can list and jump between. If a page has two nav elements, label each one, for example <nav aria-label="Primary"> and <nav aria-label="Footer">, so the list of landmarks is not two identical entries.


Images and alt text

The right alt text depends on the image's job, not on a character limit. The W3C's decision tree sorts images into five groups (W3C images tutorial).

Image type What to do Example
Informative (photo or simple graphic that adds meaning) Brief description that conveys the meaning alt="Sales chart showing 30% growth in Q3 2025"
Decorative (adds nothing, or text appears nearby) Empty alt alt=""
Functional (inside a link or button) Describe the action or destination alt="Search" for a magnifier icon in a button
Image of text Put the same text in the alt, unless the text is already real text nearby alt="Free shipping over $50"
Complex (graph, diagram) Short alt plus the full information elsewhere on the page Data table below the chart
<!-- Good: descriptive alt -->
<img src="chart.png" alt="Sales chart showing 30% growth in Q3 2025">

<!-- Good: empty alt for decorative images -->
<img src="decorative-flourish.svg" alt="">

<!-- Bad: no alt attribute at all; some screen readers read the file name -->
<img src="chart.png">

<!-- Bad: redundant or unhelpful -->
<img src="chart.png" alt="image">

Three practical rules follow from the tree. Describe what the image conveys in context, not everything it shows. Skip "image of" because screen readers already announce the element type. And never leave the attribute off: a missing alt and an empty alt="" are different instructions, and only the second says "ignore this on purpose."

The W3C tutorial gives no character limit, only that informative descriptions should be brief. Complex information belongs in the page text, not crammed into the attribute.


Color and contrast

WCAG AA sets minimum contrast ratios, which compare the relative luminance (perceived brightness) of foreground and background:

Content Minimum ratio Criterion
Normal text 4.5:1 1.4.3
Large text (18 point, or 14 point bold, roughly 24 px and 18.7 px) 3:1 1.4.3
UI component boundaries and meaningful graphics 3:1 1.4.11

Ratios are not rounded. The W3C's own example is that 4.499:1 does not meet 4.5:1 (Understanding SC 1.4.3). Logos and disabled controls are exempt.

A worked example

The W3C's forms tutorial suggests a gray such as #767676 for placeholder text so that it meets contrast requirements. The numbers show why that value is the standard answer for "lightest gray that still passes on white."

  1. #767676 has red, green, and blue values of 118 out of 255, or 0.4627.
  2. Converted to linear light, that is about 0.181 relative luminance.
  3. White has a relative luminance of 1.
  4. Contrast ratio = (1 + 0.05) / (0.181 + 0.05), which is about 4.54:1.

A slightly lighter gray such as #808080 falls to roughly 3.95:1 and fails for body text. Design tools and browser DevTools compute this for you, so do not do it by hand in practice. The point is that "light gray looks elegant" and "light gray passes" are different claims, and WebAIM finds low contrast on 83.9% of home pages.

For more on how screens represent color and why two similar-looking values can differ in luminance, see our piece on how digital color spaces work.

Do not rely on color alone

The National Eye Institute reports that about 1 in 12 men have a color vision deficiency, most commonly difficulty telling red from green (NEI). An error state shown only by a red border is invisible to many of them, and to anyone using a monochrome display or glare-prone screen.

<!-- Bad: only color signals the error -->
<input style="border-color: red;">

<!-- Good: color, an icon, and text, tied to the input -->
<label for="email">Email</label>
<input id="email" type="email" aria-invalid="true" aria-describedby="email-error"
       style="border-color: #b00020;">
<p id="email-error">
 <svg aria-hidden="true" width="16" height="16"><!-- warning icon --></svg>
 Please enter a valid email address, such as name@example.com.
</p>

Treat color as reinforcement. The meaning should survive in grayscale.


Forms: where accessibility failures lock people out

A form is a checkpoint. A missing label or an unreadable error does not just annoy a user, it ends the transaction. WebAIM found missing form labels on 51% of home pages.

Always label inputs

<!-- Right: explicit label -->
<label for="email">Email address</label>
<input type="email" id="email" name="email" autocomplete="email">

<!-- Also right: wrapping label -->
<label>
 Email address
 <input type="email" name="email" autocomplete="email">
</label>

<!-- Wrong: placeholder only -->
<input type="email" placeholder="Email">

Placeholders are hints, not labels. The W3C's forms tutorial says placeholder text is not a replacement for labels: screen readers do not treat it as one, it disappears once users start typing, and browsers often render it at low contrast (W3C forms instructions). The autocomplete attribute is a bonus. It lets browsers and password managers fill known fields, which helps people with motor and memory difficulties.

Mark required fields in two ways

<label for="name">Full name (required)</label>
<input id="name" type="text" required>

Say "required" in the label text so everyone sees it, and use the required attribute so the browser exposes the state. The aria-required attribute that older guides recommend is redundant on a native input that already has required.

Write errors that explain and connect

<label for="email">Email</label>
<input type="email" id="email" aria-invalid="true" aria-describedby="email-error">
<span id="email-error">
 Enter an email address in the format name@example.com.
</span>

aria-describedby links the message to the field, so a screen reader reads it when the field receives focus. For errors that appear after submit, a better pattern is an error summary at the top of the form that receives focus, lists each problem, and links to each field. This announces everything once and gives keyboard users a direct route to every error. Use role="alert" sparingly, because it interrupts whatever the screen reader is saying, and several alerts at once become noise.

Group related controls

<fieldset>
 <legend>Shipping address</legend>
 <label for="street">Street</label>
 <input id="street" type="text" autocomplete="street-address">
 <label for="city">City</label>
 <input id="city" type="text" autocomplete="address-level2">
</fieldset>

For radio buttons and checkboxes, fieldset and legend are what tell a screen reader user what question the options answer.

The WCAG 2.2 form criteria

Two new criteria apply directly to forms. 3.3.7 Redundant Entry says not to make users retype information they already supplied in the same process, such as a billing address that matches shipping. 3.3.8 Accessible Authentication (Minimum) says a login step cannot require a cognitive function test, such as recalling a password or solving a puzzle, unless another method or a helping mechanism is offered. W3C guidance states that copy and paste can be relied on to avoid transcription, and that blocking pasting into authentication fields forces transcription and fails the criterion unless another method exists (Understanding SC 3.3.8). In practice: do not disable paste on password fields, and do not break password managers.


ARIA: use it sparingly, and use it correctly

ARIA (Accessible Rich Internet Applications) is a set of attributes that add names, roles, and states to the accessibility tree when HTML cannot express what you built. It is a label stuck on a jar: it can describe the contents, but it does not change them. Writing role="button" tells assistive technology to treat an element as a button. It does not make it focusable or respond to Enter.

The W3C's ARIA Authoring Practices Guide puts it directly: "No ARIA is better than bad ARIA," because ARIA changes what screen reader users hear, and incorrect ARIA misrepresents what sighted users see. It also states that, unlike HTML input elements, ARIA roles do not cause browsers to provide keyboard behaviors or styling (W3C ARIA APG).

The WebAIM Million data is consistent with that warning. In 2026, 82.7% of pages used ARIA, and those pages averaged 59.1 detected errors against 42 for pages without it. WebAIM cautions that this does not prove ARIA caused the errors, since pages with more ARIA are also more complex. It does show that ARIA is no shortcut to a clean page.

When ARIA is the right tool

Situation ARIA to use Why HTML is not enough
Status message that appears without a page load role="status" or aria-live="polite" No native element announces dynamic text
Urgent error that must interrupt role="alert" Same, with higher priority
Custom widget with no native equivalent (tabs, tree view, combobox) Roles plus states such as aria-selected, aria-expanded Browsers have no native tab or tree element
Name for an icon-only control aria-label No visible text to supply a name
Hide purely decorative content from assistive tech aria-hidden="true" The content should not be announced

Live regions

<!-- Announce without stealing focus -->
<div role="status" aria-live="polite">Form saved successfully</div>

<!-- Interrupt for critical problems -->
<div role="alert">Error: payment failed</div>

A live region must exist in the page before its text changes, or some screen readers will miss the update. Insert the container on load and change its contents later.

A custom widget done properly

Tabs are the standard example of an ARIA-only pattern. The markup is the easy half.

<div role="tablist" aria-label="Account sections">
 <button role="tab" id="tab1" aria-selected="true" aria-controls="panel1">Profile</button>
 <button role="tab" id="tab2" aria-selected="false" aria-controls="panel2" tabindex="-1">Billing</button>
</div>
<div role="tabpanel" id="panel1" aria-labelledby="tab1">Profile content</div>
<div role="tabpanel" id="panel2" aria-labelledby="tab2" hidden>Billing content</div>

The other half is JavaScript. Following the pattern in the ARIA Authoring Practices Guide, the selected tab is in the Tab order, the others have tabindex="-1", and the arrow keys move between tabs and update aria-selected. Skip that half and you have made a promise the widget cannot keep. This is the practical reason to prefer a tested library over hand-rolled widgets, which a later section covers.

Common attributes

  • aria-label="..." gives an element an accessible name that overrides its text content.
  • aria-labelledby="other-id" takes the name from another element on the page.
  • aria-describedby="other-id" adds supplementary description, announced after the name.
  • aria-hidden="true" removes an element from the accessibility tree. Never put it on a focusable element.
  • aria-expanded="true|false" reports whether a disclosure control is open.
  • aria-controls="other-id" links a control to the element it affects.

Bad ARIA, good HTML

<!-- Wrong: ARIA patching a div -->
<div role="button" tabindex="0" onclick="submit()">Submit</div>

<!-- Right -->
<button type="submit">Submit</button>

<!-- Wrong: redundant ARIA that restates the element -->
<button role="button" aria-label="Submit">Submit</button>

The first rule of using ARIA is to use a native element when one exists. The second is that when you do use ARIA, you take responsibility for the keyboard behavior that goes with the role.


Keyboard navigation and focus

Everything that works with a mouse must work from the keyboard alone. This is a Level A requirement, and it also covers switch devices, voice control, and screen readers, which all lean on the same focus model.

The test

Put the mouse aside and try:

  • Tab to move forward and Shift+Tab to move back
  • Enter to follow links and press buttons
  • Space to press buttons and toggle checkboxes
  • Arrow keys inside radio groups, menus, and tab lists
  • Esc to close dialogs and menus

Common failures:

  • A custom dropdown that opens on hover and cannot be reached by Tab
  • A modal that opens but leaves focus behind on the page underneath
  • Click handlers on div elements that the keyboard cannot reach
  • Focus indicators removed by a global style reset

Focus indicators

The focus indicator shows where the keyboard is. Removing it is among the most common self-inflicted accessibility bugs.

/* Do not do this: removes the only keyboard position cue */
*:focus { outline: none; }

/* Do this: a visible, high-contrast indicator for keyboard users */
:focus-visible {
 outline: 3px solid #0057b8;
 outline-offset: 2px;
}

:focus-visible shows the ring when the browser judges it useful, which in practice means keyboard focus, and hides it on most mouse clicks. That settles the old argument between designers who disliked the ring and users who needed it.

Do not let focus disappear

WCAG 2.2 added 2.4.11 Focus Not Obscured (Minimum) at Level AA: a focused component must not be entirely hidden by author-created content. The usual culprits are sticky headers and footers, cookie banners, and non-modal dialogs. The W3C lists CSS scroll-padding as one fix, because it makes the browser scroll the focused element into view clear of the sticky bar (Understanding SC 2.4.11).

html {
 scroll-padding-top: 5rem; /* height of the sticky header */
}

Tab order and tabindex

Let DOM order drive the Tab order, and make DOM order match visual order. Three tabindex values cover nearly every case:

  • tabindex="0" puts a non-native element into the Tab order. Use it for custom widgets, once you have added the key handling.
  • tabindex="-1" makes an element focusable by script but not by Tab. Use it for managing focus, such as moving focus to a heading after navigation.
  • Positive values such as tabindex="3" rearrange the order and nearly always cause trouble. Avoid them.

Skip links

A skip link lets keyboard users jump past repeated navigation. It is the first focusable element and usually appears only when focused.

<body>
 <a href="#main" class="skip-link">Skip to main content</a>
 <nav><!-- many links --></nav>
 <main id="main" tabindex="-1">
 Actual content
 </main>
</body>
.skip-link {
 position: absolute;
 top: -40px;
 left: 0;
 background: #000;
 color: #fff;
 padding: 8px;
}

.skip-link:focus {
 top: 0; /* Appears when focused */
}

Target size and dragging

Two more WCAG 2.2 AA criteria affect touch and pointer users. 2.5.8 Target Size (Minimum) requires pointer targets of at least 24 by 24 CSS pixels. Smaller targets can still conform when a 24-pixel circle centered on each one does not overlap another target, when the target sits inline in a sentence, when an equivalent control exists, when the browser sets the size, or when the presentation is essential (Understanding SC 2.5.8). 2.5.7 Dragging Movements requires a single-pointer alternative to any drag interaction, for example up and down buttons next to a sortable list.


Modal dialogs

Modals are a classic trap because they need four behaviors at once: move focus in, keep it in, make the background unreachable, and close on Escape. The native <dialog> element handles most of that when you open it with showModal().

<button id="open">Open settings</button>

<dialog id="settings">
 <h2>Settings</h2>
 <p>Content here</p>
 <button autofocus id="close">Close</button>
</dialog>
const dialog = document.getElementById("settings");
document.getElementById("open").addEventListener("click", () => dialog.showModal());
document.getElementById("close").addEventListener("click", () => dialog.close());

MDN's documentation describes what showModal() provides: the rest of the page becomes inert, focus moves to the first nested focusable element (or the one marked autofocus), pressing Esc dismisses the dialog by default, and the dialog is exposed to assistive technology as modal (MDN: dialog element).

Two cautions apply. Opening a dialog with the plain open attribute or with show() creates a non-modal dialog, with none of the inert-background behavior. And MDN recommends always providing an explicit close button, since that is the most robust way to make sure everyone can dismiss the dialog. A hand-built modal needs all of this implemented manually, which is why the native element is the better default.


Motion, media, and time

Several Level A criteria protect users from content that moves, flashes, or plays on its own.

Criterion Requirement
1.4.2 Audio Control If audio plays automatically for more than 3 seconds, provide a way to pause or stop it, or a volume control separate from system volume
2.2.2 Pause, Stop, Hide Moving, blinking, or scrolling content that starts automatically, lasts more than 5 seconds, and sits next to other content needs a pause, stop, or hide control. Auto-updating content needs the same control or a way to set the update rate
2.3.1 Three Flashes or Below Threshold Nothing flashes more than three times in any one-second period, unless it stays below the general and red flash thresholds

Sources: W3C Understanding documents for 1.4.2, 2.2.2, and 2.3.1.

That table explains two items from the old "common mistakes" lists. An auto-advancing carousel needs a pause control. A video that starts with sound needs controls within three seconds, and the simplest answer is not to autoplay with sound at all.

Respecting reduced motion

Many operating systems let users request less animation, and CSS can read the setting. A heavy-handed rule that turns off every animation can break components that depend on transition events, so scale back only the motion that matters.

@media (prefers-reduced-motion: reduce) {
 * {
 animation-duration: 0.01ms !important;
 animation-iteration-count: 1 !important;
 transition-duration: 0.01ms !important;
 scroll-behavior: auto !important;
 }
}

Setting durations to near zero rather than none keeps animationend and transitionend events firing, so scripts that wait for them do not hang.

Captions and transcripts

Prerecorded video with speech needs captions, and audio-only content needs a transcript. Auto-generated captions are a starting draft. They routinely mangle names and technical terms, so a person should review them before publishing.

Zoom and reflow

1.4.10 Reflow (AA) requires that vertically scrolling content work at a width of 320 CSS pixels without scrolling in two dimensions. That width is what a 1280-pixel-wide window looks like at 400% zoom, so the criterion is how low-vision users who zoom in avoid horizontal scrolling (Understanding SC 1.4.10). Maps, data tables, and diagrams are exempt where two-dimensional layout is essential. A responsive layout built mobile-first usually passes with little extra work, and our guide to responsive design and mobile-first development covers the techniques.


Accessibility in React and component libraries

Frameworks do not change the rules, only where the mistakes happen. Three patterns cover most of the work.

Use semantic elements in JSX

// Wrong
<div onClick={handleClick} className="button">Click me</div>

// Right
<button type="button" onClick={handleClick}>Click me</button>

Manage focus when the screen changes

In a single-page app, a route change replaces content without a page load, so nothing tells a screen reader that anything happened. Move focus to a sensible target after navigation and after opening or closing overlays.

import { useEffect, useRef } from "react";

function Page({ title, children }) {
 const headingRef = useRef(null);

 useEffect(() => {
 headingRef.current?.focus();
 }, [title]);

 return (
 <main>
 <h1 ref={headingRef} tabIndex={-1}>{title}</h1>
 {children}
 </main>
 );
}

The heading gets tabIndex={-1} so script can focus it without adding it to the Tab order. If you use a framework with its own routing, check what it already announces before adding your own. Our comparison of Next.js and React covers how the two differ in routing and rendering. For component state patterns used above, see React Hooks explained.

Prefer libraries that implement the patterns

Building tabs, comboboxes, menus, and dialogs correctly is slow work, and subtle bugs hide in the keyboard handling. Libraries such as React Aria (Adobe), Radix UI, and Headless UI (from Tailwind Labs) ship the roles, states, and key handling for you. Radix is also the foundation of the copy-in components described in What Is shadcn/ui. Choosing one still leaves you responsible for labels, contrast, and content.

import * as Dialog from "@radix-ui/react-dialog";

<Dialog.Root>
 <Dialog.Trigger>Open</Dialog.Trigger>
 <Dialog.Portal>
 <Dialog.Overlay />
 <Dialog.Content>
 <Dialog.Title>Settings</Dialog.Title>
 <Dialog.Description>Update your preferences.</Dialog.Description>
 <Dialog.Close>Close</Dialog.Close>
 </Dialog.Content>
 </Dialog.Portal>
</Dialog.Root>

Server-rendered markup also matters here, because assistive technology reads whatever the browser has. Pages that render meaningful HTML on the server are available sooner, as discussed in what server-side rendering solves.


A testing workflow that works

No single tool certifies a page as accessible. A layered workflow catches different failures at different costs.

Layer 1: automated checks

  • axe DevTools and axe-core (Deque) for browser and test-runner scans
  • WAVE (WebAIM) for a visual overlay of issues on a live page
  • Lighthouse in Chrome DevTools, which runs a subset of axe rules
  • Pa11y and axe in CI to fail a build when a regression appears

Wire axe into your end-to-end tests so every pull request runs the scan. Playwright's accessibility testing guide shows the pattern, using rule tags to limit the scan to the WCAG levels you target:

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

test("home page has no detectable WCAG A or AA violations", async ({ page }) => {
 await page.goto("https://your-site.example/");
 const results = await new AxeBuilder({ page })
 .withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"])
 .analyze();
 expect(results.violations).toEqual([]);
});

Axe-core documents wcag22aa as the tag for WCAG 2.2 rules and notes that tags are additive, so you list every level you want (axe-core API). Playwright's own guide cautions that automated testing cannot detect all types of WCAG violations (Playwright docs).

How much do scanners catch?

Estimates vary because the unit of measurement varies. A commonly cited 20 to 30% figure counts WCAG success criteria that can be fully checked automatically. Deque's 2021 analysis of about 2,000 audits and nearly 300,000 issues found that automated testing covered an average of 57% of issues by volume, because a few easy-to-detect problem types occur very often (Deque). That study came from a vendor of axe, and the two numbers measure different things, so neither means that a clean scan equals an accessible page. A scanner can confirm that an alt attribute exists. It cannot judge whether the text is useful.

Layer 2: manual checks

Run these on every significant template or component:

  1. Keyboard pass. Complete the main tasks with keyboard only. Confirm that focus is visible everywhere and that you can leave every widget.
  2. Zoom and reflow. Set the browser to 200% and then to a 320 CSS pixel width. Look for clipped content or two-dimensional scrolling.
  3. Reduced motion. Turn on the OS setting and confirm animations calm down.
  4. Contrast in context. Check text over images and gradients, hover and focus states, and dark mode.
  5. Forms. Submit empty and invalid data. Check that each error is announced, specific, and reachable.

Layer 3: screen reader testing

Test with the combinations your users actually use. The WebAIM Screen Reader User Survey #10 (December 2023 to January 2024, 1,539 valid responses) gives the desktop picture (WebAIM survey):

Screen reader Primary desktop screen reader Commonly used
JAWS 40.5% 60.5%
NVDA 37.7% 65.6%
VoiceOver 9.7% 43.9%
Narrator 0.7% 37.3%

NVDA is free on Windows, VoiceOver is built into macOS and iOS, and TalkBack is built into Android. Thirty minutes with a screen reader and your own checkout flow will teach you more than a week of reading the criteria. Expect to be slow at first. Screen reader users operate fast, with lists of headings and landmarks and quick keyboard commands, so your pace is not their experience.

Layer 4: people

Usability testing with disabled users finds issues no checklist predicts, such as a form that technically passes every criterion but makes no sense to a user who cannot see the layout. Even a small panel, recruited and paid fairly, repays itself on a high-traffic flow.

For tooling around the build side, our overview of best web development tools in 2026 lists linters and editors that surface accessibility warnings as you type.


Common mistakes and their fixes

Mistake Why it fails Fix
outline: none on focus Keyboard users lose their place Style :focus-visible instead of removing it
div or span with click handlers Not focusable, no role, no key support Use button or a
Color-only error states Invisible to people with color vision deficiency Add text and an icon, and link the message with aria-describedby
Auto-playing video with sound Competes with screen readers and violates 1.4.2 Do not autoplay with sound, or provide controls
Auto-advancing carousel without pause Violates 2.2.2 and disorients users Add a pause control or advance only on user action
Required fields marked only with a red asterisk Color-only and not exposed programmatically Say "required" in the label and use required
Empty link text such as <a href="/x">→</a> A screen reader announces "link" with no name Add visible text, or aria-label for icon-only links
Modal that does not trap focus Keyboard users tab into the page behind it Use <dialog> with showModal()
Placeholder used as a label Not a label, vanishes on typing, low contrast Add a real <label>
Third-party widgets added without testing You own their failures Test before adopting, and report defects to the vendor

Most rows in the table have a one-line fix. The expensive failures come from custom components that were never built on native elements in the first place.


What accessibility costs, and what to claim

Cost discussions tend to attract confident numbers. Multipliers such as "retrofitting costs ten times as much as building it in" circulate widely, but they rarely come with data, so treat them with caution. The mechanism behind them is easy to see, though. Native HTML, a contrast-checked palette, and a tested component library cost almost nothing when chosen at the start. A custom widget system that ignores keyboard support is expensive to rebuild once forty screens depend on it.

Benefits are better documented than costs. Semantic headings and alt text also describe a page to search engines, as discussed in why accessibility improves web products and in our piece on why structured data helps search engines. Performance work overlaps as well, since lightweight pages help users on slow connections and assistive tools alike, a point developed in web performance optimization.

Keep claims modest. "We target WCAG 2.2 AA and test with NVDA, VoiceOver, and keyboard" is accurate and checkable. "Our site is fully accessible" is a promise nobody can keep, since new content and new browsers keep arriving. Publishing an accessibility statement with a contact route for reporting barriers is a reasonable middle path.


Myths that cause real bugs

"A score of 100 in Lighthouse means we are accessible." The score reflects only the rules Lighthouse can test automatically. It cannot tell you whether alt text is meaningful, whether the reading order makes sense, or whether a widget is usable with a screen reader.

"ARIA makes things accessible." ARIA changes what assistive technology is told, not how the page behaves. Used wrongly, it makes pages worse, which is the reason the ARIA Authoring Practices Guide warns that no ARIA is better than bad ARIA.

"Accessibility overlays fix everything." Single-script widgets that claim to repair a site automatically cannot supply missing structure, labels, and keyboard behavior that the underlying markup lacks. One summary of the European Accessibility Act notes that widgets alone are generally not sufficient for compliance with the Act or WCAG.

"This only helps blind users." The CDC figures above show that cognitive and mobility disabilities are more common than vision disabilities among US adults. Keyboard support, clear language, and predictable behavior serve the largest groups.

"Accessibility conflicts with good design." Constraints such as contrast and visible focus rule out some aesthetics, not good design. Plenty of well-regarded interfaces meet AA. Games face the same debate, and our article on game accessibility and inclusive design shows how designers resolve it in a medium with far more custom interaction than the average website.


FAQ

Q: How much accessibility do I really need? A: WCAG 2.2 AA is the practical target. The US Department of Justice's Title II rule requires WCAG 2.1 AA from state and local governments, and the European Accessibility Act applies to a wide range of consumer products and services in the EU. Whether a specific rule applies to your site depends on your sector, size, and location, so confirm with a qualified lawyer.

Q: Is AI useful for accessibility work? A: In part. Machine tools can suggest alt text, draft captions, and flag likely issues. They routinely produce generic or wrong descriptions, and they cannot judge whether a description fits the context. Treat AI output as a first draft that a person reviews.

Q: My site is small. Do I still need this? A: Obligations vary, and the European Accessibility Act exempts microenterprises that provide services, defined as fewer than 10 employees and turnover or balance sheet of no more than 2 million euros. Exemptions do not change the fact that the basics, such as labels, contrast, and keyboard support, are cheap on a small site and reach real users.

Q: How do I justify the budget to management? A: Point to risk reduction (regulation and complaints), reach (a large share of the population has a disability, per WHO and CDC), search visibility (semantic markup helps), and lower rework (native elements and tested libraries are cheaper than rebuilds). Pair the argument with a concrete first step such as adding axe to the CI pipeline.

Q: What about third-party tools like chat widgets and analytics banners? A: Test them with the same keyboard and screen reader checks you use on your own pages. Cookie banners are a frequent source of Focus Not Obscured failures. If a vendor's widget fails, ask for a fix, add a compliant alternative, or remove it.

Q: Which screen reader should I test with first? A: NVDA with Firefox or Chrome on Windows is free and widely used, and VoiceOver with Safari covers macOS and iOS. The WebAIM survey shows JAWS, NVDA, and VoiceOver all in common use, so aim to cover at least two.

Q: Does WCAG 2.2 replace 2.1? A: WCAG 2.2 builds on 2.1 and adds nine criteria while removing the obsolete Parsing criterion. Some laws still cite 2.1 AA, so building to 2.2 AA keeps you covered under both.


The takeaway

Most web accessibility failures are not exotic. WebAIM's 2026 scan found that six basic problems, from low-contrast text to missing form labels, account for most detected errors across the web, and each has a fix that comes with ordinary HTML. The pattern holds as components get more complex: native elements carry accessibility with them, and every custom replacement is a promise you must keep with your own code.

The practical sequence is short. Start from semantic HTML, pick colors that pass, label every control, keep focus visible and unobstructed, reach for ARIA only where HTML runs out, put axe in CI, and then spend an hour with a keyboard and a screen reader on your most important flow. Scanners find a large share of issues but not all of them, and people find the rest.


Read next:

Sources

Last verified: October 2026

Follow new articles

Add SciHub101 to your feed reader to see new science and technology stories.

RSS Feed

About the Author

Editorial Team

SciHub101 is an independent science and technology publication founded and edited by Buğra Sözeri, a software engineer and app developer based in Türkiye. AI tools assist with drafting and research. Source documentation in the existing archive is uneven, and articles are being reviewed and corrected. The Editorial Team byline identifies editorial responsibility; it does not certify specialist or independent human review. Where we compare products, anything built by our own team is labelled as such — see the editorial guidelines and About page for how corrections and disclosures work.

Related Articles