source: frontend/node_modules/eslint-plugin-jsx-a11y/docs/rules/media-has-caption.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# jsx-a11y/media-has-caption
2
3💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
4
5<!-- end auto-generated rule header -->
6
7Providing captions for media is essential for deaf users to follow along. Captions should be a transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information. Not only is this important for accessibility, but can also be useful for all users in the case that the media is unavailable (similar to `alt` text on an image when an image is unable to load).
8
9The captions should contain all important and relevant information to understand the corresponding media. This may mean that the captions are not a 1:1 mapping of the dialogue in the media content. However, captions are *not* necessary for video components with the `muted` attribute.
10
11## Rule options
12
13This rule takes one optional object argument of type object:
14
15```json
16{
17 "rules": {
18 "jsx-a11y/media-has-caption": [ 2, {
19 "audio": [ "Audio" ],
20 "video": [ "Video" ],
21 "track": [ "Track" ],
22 }],
23 }
24}
25```
26
27For the `audio`, `video`, and `track` options, these strings determine which JSX elements (**always including** their corresponding DOM element) should be used for this rule. This is a good use case when you have a wrapper component that simply renders an `audio`, `video`, or `track` element (like in React):
28
29### Succeed
30```jsx
31<audio><track kind="captions" {...props} /></audio>
32<video><track kind="captions" {...props} /></video>
33<video muted {...props} ></video>
34```
35
36### Fail
37```jsx
38<audio {...props} />
39<video {...props} />
40```
41
42## Accessibility guidelines
43- [WCAG 1.2.2](https://www.w3.org/WAI/WCAG21/Understanding/captions-prerecorded.html)
44- [WCAG 1.2.3](https://www.w3.org/WAI/WCAG21/Understanding/audio-description-or-media-alternative-prerecorded.html)
45
46### Resources
47- [axe-core, audio-caption](https://dequeuniversity.com/rules/axe/2.1/audio-caption)
48- [axe-core, video-caption](https://dequeuniversity.com/rules/axe/2.1/video-caption)
Note: See TracBrowser for help on using the repository browser.