noAriaUnsupportedElements (HTML)
Summary
Section titled “Summary”- Rule available since:
v2.5.0 - Diagnostic Category:
lint/a11y/noAriaUnsupportedElements - This rule is recommended, meaning it is enabled by default.
- This rule has an unsafe fix.
- The default severity of this rule is error.
- Sources:
- Inspired from
jsx-a11y/aria-unsupported-elements
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "noAriaUnsupportedElements": "error" } } }}Description
Section titled “Description”Disallow ARIA attributes on elements that cannot use them.
ARIA (Accessible Rich Internet Applications) attributes communicate an element’s role and
state to assistive technologies. The html, meta, script, and style elements do not
support ARIA roles or aria-* attributes, so those attributes provide no usable information.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<meta charset="UTF-8" role="meta" />code-block.html:1:1 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements.
> 1 │ <meta charset="UTF-8" role="meta" />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Using role on elements that do not support them can cause issues with screen readers.
ℹ Unsafe fix: Remove the role="meta" attribute.
1 │ <meta·charset="UTF-8"·role="meta"·/>
│ ------------
<html aria-required="true"></html>code-block.html:1:1 lint/a11y/noAriaUnsupportedElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid the role attribute and aria-* attributes when using meta, html, script, and style elements.
> 1 │ <html aria-required="true"></html>
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Using aria-* on elements that do not support them can cause issues with screen readers.
ℹ Unsafe fix: Remove the aria-required="true" attribute.
1 │ <html·aria-required="true"></html>
│ --------------------
<meta charset="UTF-8" /><html></html>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.