aria-invalid
Characteristics
Type:
- String
Related Concepts:
- XForms 'invalid' event
Note: This state is true if a form field is required but empty. However, the XForms valid property would be set to false.
Used in Roles:
- All elements of the base markup (Global)
- No role required
Value:
- token
- grammar: A grammatical error was detected.
- false (default): There are no detected errors in the value.
- spelling: A spelling error was detected.
- true: The value entered by the user has failed validation.
Indicates the entered value does not conform to the format expected by the application.
Set the aria-invalid state to indicate that the user input is incorrect or not within acceptable ranges. To indicate that input is required, use aria-required.
If the value is computed to be invalid or out-of-range, the application author should set this attribute to true. User agents should inform the user of the error. Application authors should provide suggestions for corrections if they are known. Authors may prevent form submission when an associated form element has its aria-invalid attribute set to true.
When the user attempts to submit data involving a field for which aria-required is true, authors may use the aria-invalid attribute to signal there is an error. However, if the user has not attempted to submit the form, authors should not set the aria-invalid attribute on required widgets simply because the user has not yet entered data.
For future expansion, the aria-invalid attribute is an enumerated type. Any value not recognized in the list of allowed values must be treated by user agents as if the value true had been provided. If the attribute is not present, or its value is false, or its value is an empty string, the default value of false applies.
Note For cross-browser compatibility, always use the aria attribute syntax to access and modify aria properties, for example object.setAttribute("aria-valuenow", newValue)
Syntax
HTML <element aria-invalid="p" ... > JavaScript object.setAttribute("aria-invalid",value);var value = object.getAttribute("aria-invalid");
Microsoft Active Accessibility Properties:
- N/A
UI Automation Properties:
- IsDataInvalidForForm
UI Automation AriaProperties Property:
- invalid