Skip to content

useMediaCaption (HTML)

biome.json
{
"linter": {
"rules": {
"a11y": {
"useMediaCaption": "error"
}
}
}
}

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

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.

<video src="video.mp4"></video>
code-block.html:1:1 lint/a11y/useMediaCaption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

> 1 │ <video src="video.mp4"></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 src="audio.mp3">
<source src="audio.ogg" type="audio/ogg" />
</audio>
code-block.html:1:1 lint/a11y/useMediaCaption ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

> 1 │ <audio src="audio.mp3">
^^^^^^^^^^^^^^^^^^^^^^^
> 2 │ <source src="audio.ogg" type="audio/ogg" />
> 3 │ </audio>
^^^^^^^^
4 │

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.

<video src="video.mp4">
<track kind="captions" src="captions.vtt" />
</video>
<audio src="audio.mp3">
<track kind="captions" src="captions.vtt" />
</audio>
<video muted src="video.mp4"></video>