Skip to content

useMediaCaption

诊断类别:lint/a11y/useMediaCaption

¥Diagnostic Category: lint/a11y/useMediaCaption

自从:v1.0.0

¥Since: v1.0.0

来源:

¥Sources:

强制 audiovideo 元素必须具有 track 作为标题。

¥Enforces that audio and video elements must have a track for captions.

¥Examples

¥Invalid

<video />
code-block.jsx:1:2 lint/a11y/useMediaCaption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide a track for captions when using audio or video elements.

> 1 │ <video />
^^^^^^^^^
2 │

Captions support users with hearing-impairments. They should be a transcription or translation of the dialogue, sound effects, musical cues, and other relevant audio information.

<audio>child</audio>
code-block.jsx:1:2 lint/a11y/useMediaCaption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide a track for captions when using audio or video elements.

> 1 │ <audio>child</audio>
^^^^^^^^^^^^^^^^^^^^
2 │

Captions support users with hearing-impairments. They should be a transcription or translation of the dialogue, sound effects, musical cues, and other relevant audio information.

¥Valid

<audio>
<track kind="captions" {...props} />
</audio>
<video muted {...props}></video>

¥Related links