useAriaPropsSupportedByRole (HTML)
Summary
Section titled “Summary”- Rule available since:
v2.5.0 - Diagnostic Category:
lint/a11y/useAriaPropsSupportedByRole - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Inspired from
jsx-a11y/role-supports-aria-props
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "useAriaPropsSupportedByRole": "error" } } }}Description
Section titled “Description”Enforce that ARIA properties are valid for the roles that are supported by the element.
Invalid ARIA properties can make it difficult for users of assistive technologies to understand the purpose of the element.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<a href="#" aria-checked="true"></a>code-block.html:1:1 lint/a11y/useAriaPropsSupportedByRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The ARIA attribute 'aria-checked' is not supported by this element.
> 1 │ <a href="#" aria-checked="true"></a>
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Assistive technologies may ignore an ARIA attribute that the role of the element does not support, or report incorrect information to the user.
ℹ Remove the attribute, or use a role that supports it.
<img alt="foobar" aria-checked="true" />code-block.html:1:1 lint/a11y/useAriaPropsSupportedByRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The ARIA attribute 'aria-checked' is not supported by this element.
> 1 │ <img alt="foobar" aria-checked="true" />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Assistive technologies may ignore an ARIA attribute that the role of the element does not support, or report incorrect information to the user.
ℹ Remove the attribute, or use a role that supports it.
<a href="#" aria-expanded="true"></a><img alt="foobar" aria-hidden="true" /><div role="heading" aria-level="1"></div>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.