Require a consistent role for presentational elements
- Rule ID:
- presentation-role-style
- Category:
- Style
- Standards:
- -
- Fixable:
- Yes
ARIA 1.1 introduces the role none as a synonym for the presentation role.
Many authors confused role="presentation" with aria-hidden="true", and role="none" conveys the intended meaning more clearly.
This rule requires one of the two synonyms to be used consistently.
By default role="none" is preferred.
Compatibility
role="none" was introduced in ARIA 1.1 and very old browsers such as Internet Explorer does not support it.
If you target ARIA 1.0 or need to support very old browsers, configure this rule to prefer role="presentation".
Rule details
Examples of incorrect code for this rule:
<img role="presentation" />
Examples of correct code for this rule:
<img role="none" />
Options
This rule takes an optional object:
{
"prefer": "none"
}
prefer
- type:
"none" | "presentation" - default:
"none"
Sets the prefered role to use.
See also
Version history
- 11.18.0 - Rule added.