useMediaCaption
Summary
Section titled “Summary”- Rule available since:
v1.0.0 - Diagnostic Category:
lint/a11y/useMediaCaption - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Same as
jsx-a11y/media-has-caption
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "useMediaCaption": "error" } } }}Description
Section titled “Description”Enforces that audio and video elements must have a track for captions.
Examples
Section titled “Examples”Invalid
Section titled “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.
<audio> <track kind="captions" {...props} /> </audio> <video muted {...props}></video>Related links
Section titled “Related links”Summary
Section titled “Summary”- Diagnostic Category:
lint/a11y/useMediaCaption - This rule is recommended, meaning it is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Same as
jsx-a11y/media-has-caption
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "useMediaCaption": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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>Accessibility guidelines
Section titled “Accessibility guidelines”Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.