Skip to content

Accessible forms: 6 mistakes that fail WCAG 2.2 and how to fix them

From the work/ 14 min read

Six form mistakes that fail WCAG 2.2, each with its criterion and level, HTML, CSS and JavaScript tested with Playwright and axe-core, and what axe cannot catch.

  • JavaScript
  • CRO
  • QA
In this article (11)
  1. What WCAG 2.2 asks of a form
  2. A placeholder is not a label
  3. Errors that do not rely on color alone
  4. Messages a screen reader announces
  5. Focus that is visible and not obscured
  6. 24 px targets
  7. Do not ask for the same thing twice
  8. How to test accessible forms
  9. Common mistakes
  10. Frequently asked questions
  11. Checklist

Accessible forms under WCAG 2.2 give every field a visible label, describe errors in text rather than color alone, announce messages to screen readers, keep focus clear of sticky bars, make targets at least 24 by 24 CSS pixels and never ask for the same data twice in one process.

Below is each mistake with its criterion and level from WCAG 2.2 (the current W3C Recommendation, dated 12 December 2024), the code that fixes it, and what happened when we tested it: we loaded a test checkout with all six mistakes and a fixed one in Chromium through Playwright and ran axe-core on both.

What WCAG 2.2 asks of a form

WCAG 2.2 added success criteria to 2.1 and removed one, 4.1.1 Parsing. The W3C states that content conforming to 2.2 also conforms to 2.0 and 2.1. Three of the new criteria hit every checkout form: 2.4.11, 2.5.8 and 3.3.7. The rest of the table comes from earlier versions and is still where fields and error messages fail most. If a contract asks for level AA, you have to meet every A criterion and every AA one.

CriterionLevelWhat it asksTypical failure
1.3.1 Info and RelationshipsAStructure you can see can also be determined in codeA field with no associated <label>
1.4.1 Use of ColorAColor is not the only visual way to convey informationAn error shown only as a red border
2.4.11 Focus Not Obscured (Minimum)AA (new)The focused component is not entirely hidden by author contentA sticky bar or cookie banner over the field
2.5.8 Target Size (Minimum)AA (new)Targets at least 24 by 24 CSS pixels, with exceptionsA 13 px checkbox next to another control
3.3.1 Error IdentificationAThe field in error is identified and the error described in text"Check the form" without saying which field
3.3.7 Redundant EntryA (new)Data already given in the same process is filled in or selectableAsking for the address again for billing
4.1.3 Status MessagesAAStatus messages reach assistive technology without taking focusAn error summary the screen reader never reads
one form with the six mistakes markedEmail106702 3BillingStreet and number6I acceptPay5Total · fixed bar4mistakecriterion1placeholder instead of a label3.3.2 A2error shown by color alone1.4.1 A3error a screen reader misses4.1.3 AA4focus hidden by a fixed bar2.4.11 AA5targets under 24 px2.5.8 AA6the address asked for twice3.3.7 Asix failures in a test checkoutaxe-core 4.12.1 flagged 1 of the 6; the other 5 need a manual test

Scroll the figure sideways to see all of it

A placeholder is not a label

A field with only placeholder="Email" looks clean and fails in practice. The W3C forms tutorial is blunt about it: placeholder text is not a replacement for labels, browsers usually render it with low contrast, and it disappears as soon as the user starts typing, so they can no longer check what each field asked for before submitting. The criterion is 3.3.2 Labels or Instructions (A), and the tie between label and field is 1.3.1 Info and Relationships (A).

One finding from the test: in Chromium 151, the placeholder-only field did get an accessible name ("Email"), because the browser falls back to the placeholder. That is why axe-core 4.12.1 did not flag it. A passing tool does not make the field right: there is still no visible label. This is the fixed field, taken from the file we tested:

<form id="checkout" novalidate>
  <p id="form-status" role="status"></p>

  <label for="email">Email (required)</label>
  <input id="email" type="email" autocomplete="email" required
         aria-describedby="email-hint email-error"
         data-error="Error: enter an email like name@example.com.">
  <p id="email-hint">We send the order confirmation here.</p>
  <p id="email-error" class="error"></p>
  1. novalidate turns off the browser's native bubbles so the form can show its own messages; required and type still validate.
  2. <p role="status"> is where the error summary will go. It must exist, empty, from page load: screen readers announce changes to a region they already know about.
  3. <label for="email"> is the visible label, tied to the field by its id. "(required)" is text, not a colored asterisk.
  4. type="email" and autocomplete="email" bring up the right phone keyboard and let the browser fill the value.
  5. aria-describedby attaches two texts to the field, the hint and the error, read after the label.
  6. data-error holds the message the script will show: what is wrong and how to fix it.
  7. The hint is always visible; the error paragraph starts empty.

The right autocomplete token and keyboard for each field are covered in mobile checkout autocomplete. This form uses the same ones.

Errors that do not rely on color alone

1.4.1 Use of Color (A) says color must not be the only visual means of conveying information. A red border with no text tells nothing to someone who cannot tell red apart, or to anyone reading a phone in the sun. 3.3.1 Error Identification (A) goes further: if an input error is detected automatically, the field must be identified and the error described in text. The fix stacks three signals: the word "Error:" with an explanation, a thicker border, and aria-invalid="true" for screen readers.

const form = document.querySelector("#checkout");
const status = document.querySelector("#form-status");

function check(field) {
  const ok = field.checkValidity();
  field.setAttribute("aria-invalid", String(!ok));
  document.getElementById(field.id + "-error").textContent = ok ? "" : field.dataset.error;
  return ok;
}

form.addEventListener("change", (e) => {
  if (e.target.getAttribute("aria-invalid") === "true") check(e.target);
});

form.addEventListener("submit", (e) => {
  const fields = [...form.elements].filter((f) => f.dataset.error && f.willValidate);
  const bad = fields.filter((f) => !check(f));
  if (!bad.length) return;
  e.preventDefault();
  status.textContent = `${bad.length} field(s) need a fix. The first one has focus.`;
  bad[0].focus();
});
  1. check(field) validates one field with checkValidity(), the native API that honors required, type and pattern.
  2. It sets aria-invalid to "true" or "false" from the result.
  3. It writes the data-error text into the error paragraph, or empties it once the field is valid. Empty it, do not just hide it: in our test, Chromium kept reading the text of a hidden paragraph referenced by aria-describedby as the description.
  4. The change listener re-checks only fields already marked invalid, so the error clears as soon as it is fixed and never shows up while someone is still typing.
  5. On submit, the filter takes the fields that carry a message and that the browser validates; willValidate is false on disabled fields.
  6. If any fail, it cancels the submit, writes the summary into the status region and moves focus to the first invalid field.

Messages a screen reader announces

4.1.3 Status Messages (AA) asks that status messages can be programmatically determined through role or properties, so assistive technology presents them without giving them focus. In WAI-ARIA 1.2, role="status" carries an implicit aria-live of polite: the screen reader finishes what it is saying, then reads the change. Understanding 4.1.3 lists using role="alert" or aria-live="assertive" on content that is not important and time-sensitive as a failure, so the summary goes in status.

The summary says how many fields failed. Each field's own error arrives through aria-describedby when focus lands on it. This is what Chromium's accessibility tree showed after submitting the empty form:

  • Fixed form: the status region read "3 field(s) need a fix. The first one has focus."; focus was on the email field; its name was "Email (required)"; its description, the hint followed by "Error: enter an email like name@example.com."; its state, invalid.
  • Six-mistake form: name "Email" (taken from the placeholder), no description, state valid, no live region at all, and focus stayed on the button. On screen, a red border; to a screen reader, nothing.
the same error, before and afterbeforeana.example.comonly the red bordername: Emaildescription: (empty)aria-invalid: falsestatus region: noneafterEmail (required)ana.example.comError: enter a valid emailname: Email (required)description: hint + erroraria-invalid: truerole="status": 3 fieldstext + border + aria-invalid + aria-describedby + role=statuswhat the eye sees and what the reader getsChromium 151 accessibility tree on the two test forms

Scroll the figure sideways to see all of it

Focus that is visible and not obscured

Two criteria apply. 2.4.7 Focus Visible (AA) asks for a visible focus indicator: outline: none with no replacement breaks it. 2.4.11 Focus Not Obscured (Minimum) (AA) is new in 2.2: when a component receives keyboard focus, it must not be entirely hidden by author-created content. Understanding 2.4.11 names the usual culprits, sticky headers, sticky footers and non-modal dialogs, and says a cookie banner that entirely hides the focused component fails. The AAA version, 2.4.12, asks that no part be hidden.

If you fixed CLS by pinning the cookie banner to the bottom, as in fixing CLS from a cookie banner, that banner is exactly what 2.4.11 is about. The W3C gives two ways out: make the banner modal, which a dialog element modal does, or leave room with scroll-padding, technique C43. For a checkout total bar, the second:

html { scroll-padding-bottom: 5rem; }   /* the fixed bar is 4rem tall */
body { padding-bottom: 5rem; }
:focus-visible { outline: 3px solid #135cfa; outline-offset: 2px; }
.total-bar { position: fixed; inset: auto 0 0; box-sizing: border-box; min-height: 4rem; }
  1. scroll-padding-bottom tells the browser the bottom 5rem of the viewport do not count as visible when it scrolls an element into view, and that includes the field that takes focus on Tab.
  2. The body's padding-bottom lets the last control scroll above the bar; without it, the final button stays underneath even at the very bottom of the page.
  3. :focus-visible draws a 3px outline offset from the field, which stays visible over the red error border.
  4. box-sizing: border-box makes the bar exactly 4rem. Our first run lacked it: the padding took the bar to 81px, one more than the scroll-padding, and the checkbox ended one pixel under the bar. Measure the bar and leave a margin.

Tabbing through a 375 by 360 viewport, all seven stops in the fixed form stayed above the bar. In the six-mistake form, the last postal code ended partly covered, and the checkbox and the Pay button entirely. Playwright could not even click Pay: the bar intercepted the click.

24 px targets

2.5.8 Target Size (Minimum) (AA), new in 2.2, asks that pointer targets be at least 24 by 24 CSS pixels. It has five exceptions: spacing (a 24 px circle centered on the target does not touch another target), equivalent (another control on the page does the same and passes), inline (a link inside a sentence), user agent control (the browser sets the size and you did not change it) and essential. The AAA version, 2.5.5, goes up to 44 by 44. The details are in Understanding 2.5.8.

input, button { min-height: 44px; }
.check input { width: 24px; height: 24px; }
  1. Fields and buttons are at least 44px tall: well over the 24 minimum and easy for a thumb.
  2. The "same as shipping" checkbox is 24 by 24. The label around it also toggles it on click, but do not count on that for size.

In the six-mistake form we measured a 13 by 13 checkbox and a 33 by 22 Pay button. axe-core passed its target-size rule on both: nothing else was close, so the spacing exception applied. That is correct under the criterion, and fragile: add a link next to them and they fail. Give them the size and stop worrying.

Do not ask for the same thing twice

3.3.7 Redundant Entry (A) asks that information the user already gave in the same process be filled in automatically or be available to select, unless re-entering it is essential, required for security (a password, say) or no longer valid. Understanding 3.3.7 makes three points: browser autocomplete is not considered sufficient, because the site has to provide the data; it does not require storing anything between sessions; and a third-party payment step inside the checkout is in scope. Its example is the familiar one: a "billing address is the same as shipping" checkbox.

<label class="check"><input id="same" type="checkbox" checked>
  Billing address is the same as shipping</label>

<fieldset id="billing" hidden disabled>
  <legend>Billing address</legend>
  <label for="bill-zip">Postal code (required)</label>
  <input id="bill-zip" autocomplete="billing postal-code" inputmode="numeric"
         required pattern="[0-9]{5}" data-copy="ship-zip"
         aria-describedby="bill-zip-error"
         data-error="Error: the postal code has 5 digits, for example 06700.">
  <p id="bill-zip-error" class="error"></p>
</fieldset>

<script>
const same = document.querySelector("#same");
const billing = document.querySelector("#billing");

same.addEventListener("change", () => {
  billing.hidden = billing.disabled = same.checked;
  // Unticked: start from the shipping address, not from empty fields.
  for (const f of billing.elements) f.value ||= form.elements[f.dataset.copy].value;
});
</script>
  1. The checkbox starts ticked: on most orders, the billing fields never show.
  2. The fieldset starts hidden and disabled. While disabled, its fields are neither validated nor submitted.
  3. autocomplete="billing postal-code" tells the billing postal code apart from the shipping one.
  4. data-copy names the shipping field the starting value comes from.
  5. When the box is unticked, the script shows and enables the group, and each empty field takes its shipping twin's value through ||=, without overwriting anything the user already changed.

In the test we typed "Av. Insurgentes 100" and "06700" into shipping (illustrative data), unticked the box, and both billing fields appeared with those values. The tested file also has the billing street; it is left out here for space. Another W3C example that fits any checkout: when a card is declined, do not wipe what was already typed.

How to test accessible forms

We ran both files in Chromium 151 with Playwright 1.62 and axe-core 4.12.1, using the rule tags for WCAG 2.0 to 2.2 at A and AA plus best practices. This is the summary the script printed:

form-good.html
  axe, on load ............. 0 violations
  axe, errors shown ........ 0 violations
  axe, billing open ........ 0 violations
  Tab walk at 375x360 ...... 7 stops, none under the fixed bar
  targets under 24x24 ...... none
form-bad.html
  axe ...................... 1 violation: label (the bare checkbox)
  Tab walk at 375x360 ...... bill-zip partly, terms and Pay entirely hidden
  targets under 24x24 ...... terms 13x13, Pay 33x22 (axe: pass by spacing)
  1. The fixed form passes axe in all three states: on load, with errors, and with billing open.
  2. The Tab walk measures each focused field against the fixed bar, in a short viewport, where the problem shows up.
  3. The six-mistake form has a single axe violation: the checkbox with no label. axe missed the other five mistakes.
  4. The Tab walk and the target measurement are what found the hidden focus and the small controls.

One out of six. axe covers what can be measured in the DOM, and you test the rest: go through the form with the keyboard only, submit it empty and listen to what a screen reader announces (NVDA on Windows, VoiceOver on macOS and iOS), then repeat in a short window with the bar or banner showing. We checked Chromium's accessibility tree, not a real screen reader; before you ship a checkout, run that last test.

WCAG 2.2 criterion → fix in the formcriterionlevelfix1.3.1Aa <label for> tied to every field1.4.1Athe word “Error:” as well as red2.4.11AAscroll-padding as tall as the fixed bar2.5.8AA24 × 24 px at least, or space around it3.3.1Athe field and the error described in text3.3.7Aa “same as shipping” box, data copied over4.1.3AAa summary in role="status", no focus movethree criteria new in 2.2: 2.4.11, 2.5.8, 3.3.7source: WCAG 2.2, W3C Recommendation, 12 December 2024

Scroll the figure sideways to see all of it

Common mistakes

  • Trusting the label because axe passes. Chromium names the field from the placeholder; the visible label is still missing.
  • Hiding the error with hidden instead of emptying it. aria-describedby keeps reading it.
  • Creating the status region when the error appears. It must exist first; if it arrives already filled, a screen reader may not announce it.
  • Using role="alert" for everything. It interrupts the screen reader; the W3C keeps it for what is important and urgent.
  • A scroll-padding smaller than the bar. It happened to us by one pixel. Measure the bar with its padding.
  • Removing the outline with no other indicator. It fails 2.4.7 even when nothing covers the field.
  • Relying on browser autocomplete for 3.3.7. The W3C says it is not enough: the site has to offer the data.

Frequently asked questions

Does WCAG 2.2 replace WCAG 2.1?

It does not deprecate it, but it covers it: per the W3C, content that conforms to 2.2 also conforms to 2.0 and 2.1. If you target 2.1 AA today, adding 2.4.11, 2.5.8 and 3.3.7 to your forms gets that part of the site to 2.2.

Is passing axe or Lighthouse enough?

No. In our test axe found one of the six mistakes. Automated tools cannot tell whether a red border explains anything, whether a bar covers focus while tabbing, or whether the site asks for data twice. Run them first, then test with a keyboard and a screen reader.

Should I use aria-live or role="status"?

role="status" already carries an implicit aria-live="polite" and aria-atomic="true" under WAI-ARIA 1.2, and it says what the region is. For an error summary it is the right fit. Keep role="alert" (assertive) for urgent messages.

Does browser autofill satisfy Redundant Entry?

No. Understanding 3.3.7 says it is not considered sufficient, because the site must offer what the user already entered in the same process. Use autocomplete anyway: it speeds up filling and meets 1.3.5 Identify Input Purpose (AA).

Checklist

  • Every field has a visible <label> tied by for and id; a placeholder, if any, only shows an example.
  • Required fields say so in text.
  • Each error has text ("Error: …"), a border and aria-invalid="true".
  • The error is tied to its field with aria-describedby and emptied once fixed.
  • The role="status" region exists empty from load and receives the summary.
  • Focus moves to the first invalid field.
  • :focus-visible draws an outline you can see.
  • scroll-padding-bottom is taller than the fixed bar or banner.
  • Fields, buttons and checkboxes are at least 24 by 24 px.
  • Billing offers "same as shipping" and copies the data.
  • You ran axe, a Tab walk in a short viewport and a screen reader.

These fixes also help anyone buying on a phone in a hurry. If you are working on the checkout, start with the fields: autocomplete and keyboards in mobile checkout.

Saw this on Instagram? Every Reel guide is at ecomlabs.dev/guides.

Written by

Luis Morales

Luis Morales

Frontend and Shopify developer, EcomLabs

@luismoralesdev on Instagram

Published November 19, 2026 · updated November 20, 2026

← Blog