Skip to main content
WCAGrules
Quick navigation

ARIA property

aria-errormessage

Points at the message explaining why this field is invalid. Only meaningful while aria-invalid is set.

It connects a field to the sentence explaining what went wrong. On its own it changes nothing, because browsers are required not to expose it while the field's aria-invalid is false. Set aria-invalid to true and the message becomes reachable.

Which roles may carry aria-errormessage

Value
ID reference
Filed as
A property, which is how ARIA files it and not a rule about how often it changes.

Those lists are not advice. Browsers are required to ignore a non-global attribute sitting on a role that does not support it, so aria-errormessage on the wrong element is not weak, it is absent. You can read it in the DOM and nobody using a screen reader can.

Every role above comes from the specification's own list for this attribute, checked name for name. The normative definition stays with the W3C, in the aria-errormessage section of the ARIA specification.

Keeping aria-errormessage true

This attribute has a partner, and the spec makes the pairing a requirement rather than a suggestion. Both have to flip when validation state changes and both have to flip back when the field is fixed, or you get a field announcing as valid while still carrying a pointer to an error. The message element also has to exist for the reference to resolve at all, which pushes you towards rendering an empty container up front and filling it, rather than adding the whole thing at the moment validation fails. If you meet this on an element with no supporting role, note that its global use was deprecated in ARIA 1.2, so it now belongs only on roles that list it.

How aria-errormessage gets checked

There are test rules that check an ARIA attribute is one that exists, is allowed on the role underneath it, and carries a value of the right type. What they map to is ARIA's own author requirements rather than any WCAG criterion, so a misplaced attribute breaks ARIA without being a WCAG failure by itself. It becomes one under 4.1.2 Name, Role, Value the moment the missing or wrong value means the control's state cannot be worked out programmatically, which is what usually happens next.

The value testing skips id references on purpose. Pointing at an element that does not exist and having no pointer at all come to the same end, so a broken reference fails no rule directly. It fails later, wherever the missing name or description was needed.

Nothing automated catches the failure this page is about. A stale value is a valid value, on a permitted role, with the right type. It is only wrong about the world.

Attributes you will meet alongside aria-errormessage

  • aria-activedescendant Points at the item inside a composite widget that is currently active, when focus stays on the container.
  • aria-autocomplete How a text field predicts what you are typing.
  • aria-checked Whether a checkbox, radio or switch is on, off, or partly on.
  • aria-disabled Says a control is present but not available. Unlike the disabled attribute, it stays focusable, so people can still find out it is there.
  • aria-expanded Whether the thing this control opens is currently open.
  • aria-haspopup Says this control opens something, and what kind of thing it opens. A menu, a dialog, a listbox.
  • aria-invalid Says a field's value has failed validation.
  • aria-multiline Whether a text field takes more than one line, which changes what Enter does.

Every ARIA state and property · Every ARIA role · ARIA explained

Go somewhere useful

Find tools, resources and your workspace.

29 destinations