HTML aria-invalid ARIA Attribute
The aria-invalid attribute tells assistive technology that the value entered in a form field is not valid, for example after a failed validation.
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
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.
Desktop





Tablets & Mobile





