Favorites

HTML aria-invalid ARIA Attribute

aria-invalid
ARIA AttributeThis ARIA attribute is supported by all modern browsers.
Updated 28th November 2026

The aria-invalid attribute tells assistive technology that the value entered in a form field is not valid, for example after a failed validation.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The aria-invalid attribute marks the value of a form field as invalid. Screen readers announce it, for example "Email, edit text, invalid entry", so users know they need to fix something. It can also mark text with a grammar or spelling error.

Only set it after the user has had a chance to enter a value, usually when they leave the field or submit the form, not while the field is still empty on page load. Always explain the problem as well: link the error message with aria-errormessage or aria-describedby, and remove aria-invalid once the value is corrected.

Native constraint validation, such as required or type="email", does not set aria-invalid for you, so add it in your script. It also works as a CSS hook, for example [aria-invalid="true"], to highlight the field.

Properties

Type
Global
Value
token
Default
false
Used with
application, checkbox, combobox, gridcell, listbox, radiogroup, slider, spinbutton, textbox, tree

Syntax

<element aria-invalid="true | false | grammar | spelling">

Values

  • trueThe value is invalid.
  • falseThe default: the value is valid, or it hasn't been checked.
  • grammarA grammatical error was found.
  • spellingA spelling error was found.

Example

<form onsubmit="event.preventDefault();var f=document.getElementById('age'),bad=!(f.value>=18);f.setAttribute('aria-invalid',bad);document.getElementById('age-err').hidden=!bad;">
<label for="age">Age</label>
<input id="age" type="number" aria-describedby="age-err">
<p id="age-err" hidden style="color:#b91c1c">You must be 18 or older.</p>
<button>Continue</button>
</form>
<style>[aria-invalid="true"]{border:2px solid #b91c1c}</style>

Browser Support

The following information will show you the current browser support for the aria-invalid ARIA attribute. Hover over a browser icon to see the version that first introduced support for this ARIA attribute.

This ARIA attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee