Skip to content

noDistractingElements

诊断类别:lint/a11y/noDistractingElements

¥Diagnostic Category: lint/a11y/noDistractingElements

自从:v1.0.0

¥Since: v1.0.0

来源:

¥Sources:

强制不使用分散注意力的元素。

¥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 />

¥Accessibility guidelines

¥Related links