noAriaUnsupportedElements
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/a11y/noAriaUnsupportedElements¥Diagnostic Category:
lint/a11y/noAriaUnsupportedElements -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则包含 unsafe 修复程序。
¥This rule has an unsafe fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
¥How to configure
{ "linter": { "rules": { "a11y": { "noAriaUnsupportedElements": "error" } } }}¥Description
强制不支持 ARIA 角色、状态和属性的元素不具有这些属性。
¥Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
¥Examples
¥Invalid
<meta charset="UTF-8" role="meta" />code-block.jsx: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" />code-block.jsx: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” />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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”·/>
│ ---------------------
¥Valid
<meta charset="UTF-8" /><html></html>¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号