noRedundantRoles
诊断类别:lint/a11y/noRedundantRoles
¥Diagnostic Category: lint/a11y/noRedundantRoles
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
jsx-a11y/no-redundant-roles
¥Same as:
jsx-a11y/no-redundant-roles
强制默认函数参数和可选函数参数位于最后。
¥Enforce explicit role
property is not the same as implicit/default role property on an element.
¥Examples
¥Invalid
code-block.jsx:1:15 lint/a11y/noRedundantRoles FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Using the role attribute ‘article’ on the ‘article’ element is redundant, because it is implied by the semantic ‘article’ element.
> 1 │ <article role=‘article’></article>
│ ^^^^^^^^^
2 │
ℹ Unsafe fix: Remove the role attribute.
1 │ <article·role=‘article’></article>
│ --------------
code-block.jsx:1:14 lint/a11y/noRedundantRoles FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Using the role attribute ‘button’ on the ‘button’ element is redundant, because it is implied by the semantic ‘button’ element.
> 1 │ <button role=‘button’></button>
│ ^^^^^^^^
2 │
ℹ Unsafe fix: Remove the role attribute.
1 │ <button·role=‘button’></button>
│ -------------
code-block.jsx:1:10 lint/a11y/noRedundantRoles FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Using the role attribute ‘heading’ on the ‘h1’ element is redundant, because it is implied by the semantic ‘h1’ element.
> 1 │ <h1 role=‘heading’ aria-level=‘1’>title</h1>
│ ^^^^^^^^^
2 │
ℹ Unsafe fix: Remove the role attribute.
1 │ <h1·role=‘heading’·aria-level=‘1’>title</h1>
│ ---------------
¥Valid
¥Related links