useValidAriaValues
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/a11y/useValidAriaValues¥Diagnostic Category:
lint/a11y/useValidAriaValues -
此规则为推荐规则,默认启用。
¥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:
-
¥Same as
jsx-a11y/aria-proptypes
-
¥How to configure
{ "linter": { "rules": { "a11y": { "useValidAriaValues": "error" } } }}¥Description
强制正确使用 和 。
¥Enforce that ARIA state and property values are valid.
¥Examples
¥Invalid
<span role="checkbox" aria-checked="test">some text</span>code-block.jsx:1:23 lint/a11y/useValidAriaValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The value of the ARIA attribute aria-checked is not correct.
> 1 │ <span role=“checkbox” aria-checked=“test”>some text</span>
│ ^^^^^^^^^^^^^^^^^^^
2 │
ℹ The only supported value for the aria-checked property one of the following:
- false
- true
- mixed
<span aria-labelledby="">some text</span>code-block.jsx:1:7 lint/a11y/useValidAriaValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The value of the ARIA attribute aria-labelledby is not correct.
> 1 │ <span aria-labelledby="">some text</span>
│ ^^^^^^^^^^^^^^^^^^
2 │
ℹ The only supported value is a space-separated list of HTML identifiers.
<span aria-valuemax="hey">some text</span>code-block.jsx:1:7 lint/a11y/useValidAriaValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The value of the ARIA attribute aria-valuemax is not correct.
> 1 │ <span aria-valuemax=“hey”>some text</span>
│ ^^^^^^^^^^^^^^^^^^^
2 │
ℹ The only supported value is number.
<span aria-orientation="hey">some text</span>code-block.jsx:1:7 lint/a11y/useValidAriaValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The value of the ARIA attribute aria-orientation is not correct.
> 1 │ <span aria-orientation=“hey”>some text</span>
│ ^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ The only supported value for the aria-orientation property is one of the following:
- undefined
- horizontal
- vertical
¥Valid
<> <span role="checkbox" aria-checked={checked} >some text</span> <span aria-labelledby="fooId barId" >some text</span></>可访问性指南
Section titled “可访问性指南”¥Accessibility guidelines
¥Resources
¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号