useMediaCaption
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/a11y/useMediaCaption¥Diagnostic Category:
lint/a11y/useMediaCaption -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
jsx-a11y/media-has-caption相同¥Same as
jsx-a11y/media-has-caption
-
¥How to configure
{ "linter": { "rules": { "a11y": { "useMediaCaption": "error" } } }}¥Description
强制 audio 和 video 元素必须具有 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
Biome v2.1 中文网 - 粤ICP备13048890号