useAriaPropsSupportedByRole
诊断类别:lint/nursery/useAriaPropsSupportedByRole
¥Diagnostic Category: lint/nursery/useAriaPropsSupportedByRole
自从:v1.9.0
¥Since: v1.9.0
来源:
¥Sources:
-
与以下相同:
jsx-a11y/role-supports-aria-props
¥Same as:
jsx-a11y/role-supports-aria-props
强制 ARIA 属性对于元素支持的角色有效。
¥Enforce that ARIA properties are valid for the roles that are supported by the element.
无效的 ARIA 属性会使辅助技术的用户难以理解元素的用途。
¥Invalid ARIA properties can make it difficult for users of assistive technologies to understand the purpose of the element.
¥Examples
¥Invalid
code-block.jsx:1:1 lint/nursery/useAriaPropsSupportedByRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The ARIA attribute ‘aria-checked’ is not supported by this element.
> 1 │ <a href=”#” aria-checked />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Ensure that ARIA attributes are valid for the role of the element.
code-block.jsx:1:1 lint/nursery/useAriaPropsSupportedByRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The ARIA attribute ‘aria-checked’ is not supported by this element.
> 1 │ <img alt=“foobar” aria-checked />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Ensure that ARIA attributes are valid for the role of the element.
¥Valid
¥Related links