Web Accessibility Cheat Sheet: ARIA, WCAG 2.2 and Contrast
Checked against WCAG and WAI-ARIA WCAG 2.2 (W3C Recommendation, 12 Dec 2024 edition) and WAI-ARIA 1.2 (Recommendation, 6 Jun 2023) on 28 November 2026. Each section links to the official docs it was checked against.
This sheet is for front-end developers who need to pass a WCAG 2.2 AA audit without reading the whole spec. It follows the W3C texts of WCAG 2.2 (current edition dated 12 December 2024) and WAI-ARIA 1.2. Thresholds and attribute values are quoted from those documents; the markup rows are standard HTML and ARIA, not test results from a screen reader, so they are marked untested.
When to use what
Use a native element before you reach for ARIA. A <button> gives you the role, focus, Enter and Space handling and the disabled state for free; a <div role="button"> gives you only the role and leaves the rest to you. That is the first rule in the W3C's Using ARIA note, and most audit failures we see are broken copies of native controls.
Add ARIA when HTML has no element for the pattern (tabs, a disclosure that controls another region, a live status message) or when you need to name something that has no visible text, such as an icon-only button. For names, visible text wins: aria-labelledby pointing at text on screen keeps the spoken name in sync with what sighted users read, which is what 2.5.3 Label in Name asks for. Our ARIA attribute reference lists which attributes each role allows, and the ARIA label generator helps write names for icon buttons.
Automated checkers catch missing alt text and low contrast but not focus order or confusing names, so plan a keyboard pass by hand. The accessibility testing post describes a split that works, and the focus order tester shows the tab sequence of a snippet.
<button type="button">Save</button>Rule 1: use the native element when one exists instead of role="button" on a div
<div role="tab"><h2>Billing</h2></div>Rule 2: don't change native semantics; wrap the heading rather than putting role="tab" on the h2
Enter and Space on role="button"Rule 3: any custom ARIA control must work from the keyboard
<button aria-hidden="true">Rule 4 violation: never hide a focusable element or its ancestor from assistive tech
<label for="email">Email</label><input id="email">Name a form field with a visible label, the most reliable method
<button aria-label="Close"><svg aria-hidden="true">…</svg></button>Name an icon-only button and hide the decorative icon
aria-labelledby="dlg-title"Name an element from visible text elsewhere, by id; takes a list of ids
aria-describedby="pw-hint"Attach longer help text, read after the name; the referenced elements form the whole description
<img src="chart.png" alt="Sales rose 12% in Q3">Give an informative image a text alternative (1.1.1); use alt="" for decoration
Values below are the ones WAI-ARIA 1.2 defines. Check allowed roles per attribute in the ARIA attribute reference.
aria-expanded="false"On a disclosure button: the region it controls is collapsed; true when open
aria-controls="menu-1"Point to the element whose content this control changes (id list)
aria-current="page"Mark the current link in a nav; values page, step, location, date, time, true, false
aria-pressed="true"Turn a button into a toggle button; values true, false, mixed
aria-checked="mixed"Tri-state checkbox; mixed isn't valid on radio or switch
aria-selected="true"Mark the selected tab in a tablist; other tabs get false
aria-invalid="true"Flag a field that failed validation; also grammar or spelling
aria-live="polite"Announce changes at the next pause; assertive interrupts, off is the default
aria-hidden="true"Remove decorative content from the accessibility tree; never on focusable elements
1.1.1 Non-text Content (A)Every image, icon and control has a text alternative that serves the same purpose
1.3.1 Info and Relationships (A)Headings, lists, tables and labels are in the markup, not only in styling
1.4.10 Reflow (AA)Content works at 320 CSS px wide without horizontal scrolling (a 1280 px window at 400% zoom)
1.4.12 Text Spacing (AA)Nothing breaks when users set line height 1.5, paragraph spacing 2, letter 0.12 and word 0.16 times the font size
2.1.1 Keyboard (A)Everything works with a keyboard alone
2.4.3 Focus Order (A)Tab order follows the meaning of the page
2.4.7 Focus Visible (AA)Keyboard focus always has a visible indicator
2.5.3 Label in Name (A)The accessible name contains the visible label text
3.3.2 Labels or Instructions (A)Inputs that need user data have labels or instructions
4.1.2 Name, Role, Value (A)Custom controls expose name, role and state to assistive tech
4.1.3 Status Messages (AA)Status updates are announced without moving focus, for example via role="status"
2.4.11 Focus Not Obscured (Minimum) (AA)A focused element must not be entirely hidden by your own sticky headers, banners or chat widgets
2.5.7 Dragging Movements (AA)Anything done by dragging also works with single clicks or taps, unless dragging is essential
2.5.8 Target Size (Minimum) (AA)Pointer targets are at least 24 by 24 CSS px, or spaced so a 24 px circle on each doesn't overlap another
3.2.6 Consistent Help (A)Help links or contact options repeated across pages stay in the same relative order
3.3.7 Redundant Entry (A)Don't make users retype what they already entered in the same process; prefill or offer it
3.3.8 Accessible Authentication (Minimum) (AA)Login can't rely on remembering or transcribing unless paste and password managers work or there's an alternative
4.5:1Minimum for normal body text at AA (1.4.3)
3:1Minimum for large text at AA: at least 18 pt, or 14 pt bold
3:1 non-text (1.4.11)Minimum for UI component boundaries, focus rings and meaningful icons against adjacent colours
7:1 and 4.5:1AAA (1.4.6) for normal and large text respectively
Worked example: Turn a div toggle into an accessible disclosure
A common audit finding: a clickable div that opens a filter panel.
<!-- before -->
<div class="toggle" onclick="togglePanel()">Filters ▾</div>
<div id="filters" hidden>…</div>
<!-- after -->
<button type="button" aria-expanded="false" aria-controls="filters">Filters</button>
<div id="filters" hidden>…</div>
<script>
const btn = document.querySelector('[aria-controls="filters"]');
btn.addEventListener('click', () => {
const open = btn.getAttribute('aria-expanded') === 'true';
btn.setAttribute('aria-expanded', String(!open));
document.getElementById('filters').hidden = open;
});
</script>
The before version fails 2.1.1 (no keyboard access, since a div isn't focusable) and 4.1.2 (no role or state exposed). Swapping in a button fixes focus and Enter and Space handling in one go, which is the first rule of ARIA at work. aria-expanded tells a screen reader whether the panel is open, and the script keeps it in sync with hidden. We didn't run this through a screen reader for this sheet; when you test it, the button should be announced with its name, its button role and a collapsed or expanded state, and the state should change each time you press Space.
Common mistakes
Marking the active tab with
aria-currentinstead ofaria-selected.Use
aria-selected="true"on the active tab andfalseon the others; the ARIA spec says not to swap the two where they mean the same thing.Adding
role="button"to a div and stopping there.Use a real
<button>; if you can't, addtabindex="0"and handle Enter and Space yourself.Removing focus outlines with
outline: nonefor looks.Style a visible
:focus-visiblering with at least 3:1 contrast against the background.A sticky cookie banner or header covering the focused link as users tab down the page.
Add
scroll-padding-topequal to the header height and let banners be dismissed, to meet 2.4.11.Blocking paste in password or one-time code fields.
Allow paste and
autocompleteso password managers work; 3.3.8 treats that as the help mechanism.Making a visible label say "Search" while
aria-labelsays "Find products".Keep the visible words in the accessible name so voice users can say what they see (2.5.3).
Related cheat sheets
Sources
- https://www.w3.org/TR/WCAG22/
- https://www.w3.org/WAI/standards-guidelines/wcag/new-in-22/
- https://www.w3.org/TR/wai-aria-1.2/
- https://www.w3.org/TR/using-aria/
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.