noDistractingElements
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/a11y/noDistractingElements¥Diagnostic Category:
lint/a11y/noDistractingElements -
此规则为推荐规则,默认启用。
¥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": { "noDistractingElements": "error" } } }}¥Description
强制不使用分散注意力的元素。
¥Enforces that no distracting elements are used.
视觉上分散注意力的元素可能会导致视障用户的可访问性问题。这样的元素很可能已被弃用,应尽量避免。默认情况下,以下元素在视觉上会分散注意力:<marquee> 和 <blink>。
¥Elements that can be visually distracting can cause accessibility issues with visually impaired users.
Such elements are most likely deprecated, and should be avoided.
By default, the following elements are visually distracting: <marquee> and <blink>.
¥Examples
¥Invalid
<marquee />code-block.jsx:1:1 lint/a11y/noDistractingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Don’t use the ‘marquee’ element.
> 1 │ <marquee />
│ ^^^^^^^^^^^
2 │
ℹ Visually distracting elements can cause accessibility issues and should be avoided.
ℹ Unsafe fix: Remove the ‘marquee’ element.
1 │ <marquee·/>
│ -----------
<blink />code-block.jsx:1:1 lint/a11y/noDistractingElements FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Don’t use the ‘blink’ element.
> 1 │ <blink />
│ ^^^^^^^^^
2 │
ℹ Visually distracting elements can cause accessibility issues and should be avoided.
ℹ Unsafe fix: Remove the ‘blink’ element.
1 │ <blink·/>
│ ---------
¥Valid
<div />可访问性指南
Section titled “可访问性指南”¥Accessibility guidelines
¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号