useAriaPropsForRole
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/a11y/useAriaPropsForRole¥Diagnostic Category:
lint/a11y/useAriaPropsForRole -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
¥How to configure
{ "linter": { "rules": { "a11y": { "useAriaPropsForRole": "error" } } }}¥Description
强制具有 ARIA 角色的元素必须具有该角色所需的所有 ARIA 属性。
¥Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
¥Examples
¥Invalid
<span role="checkbox"></span>code-block.jsx:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The element with the checkbox ARIA role does not have the required ARIA attributes.
> 1 │ <span role=“checkbox”></span>
│ ^^^^^^^^^^^^^^^
2 │
ℹ Missing ARIA prop(s):
- aria-checked
<span role="heading"></span>code-block.jsx:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The element with the heading ARIA role does not have the required ARIA attributes.
> 1 │ <span role=“heading”></span>
│ ^^^^^^^^^^^^^^
2 │
ℹ Missing ARIA prop(s):
- aria-level
¥Valid
<span role="checkbox" aria-checked="true"></span><span role="heading" aria-level="1"></span>可访问性指南
Section titled “可访问性指南”¥Accessibility guidelines
¥Resources
¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号