File tree Expand file tree Collapse file tree 5 files changed +60
-5
lines changed
src/compiler/compile/nodes
css/samples/omit-scoping-attribute-attribute-selector
validator/samples/a11y-media-has-caption Expand file tree Collapse file tree 5 files changed +60
-5
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,25 @@ export default class Element extends Node {
528
528
}
529
529
}
530
530
531
+ if ( this . is_media_node ( ) ) {
532
+ if ( attribute_map . has ( 'muted' ) ) {
533
+ return ;
534
+ }
535
+
536
+ let has_caption ;
537
+ const track = this . children . find ( ( i : Element ) => i . name === 'track' ) ;
538
+ if ( track ) {
539
+ has_caption = track . attributes . find ( a => a . name === 'kind' && a . get_static_value ( ) === 'captions' ) ;
540
+ }
541
+
542
+ if ( ! has_caption ) {
543
+ component . warn ( this , {
544
+ code : `a11y-media-has-caption` ,
545
+ message : `A11y: Media elements must have a <track kind="captions">`
546
+ } ) ;
547
+ }
548
+ }
549
+
531
550
if ( a11y_no_onchange . has ( this . name ) ) {
532
551
if ( handlers_map . has ( 'change' ) && ! handlers_map . has ( 'blur' ) ) {
533
552
component . warn ( this , {
Original file line number Diff line number Diff line change 1
- < div > < video class ="svelte-xyz " autoplay > </ video >
2
- < video > </ video > </ div >
1
+ < div > < video class ="svelte-xyz " autoplay muted > </ video >
2
+ < video muted > </ video > </ div >
Original file line number Diff line number Diff line change 1
1
<div >
2
- <video autoplay ></video >
3
- <video ></video >
2
+ <video autoplay muted ></video >
3
+ <video muted ></video >
4
4
</div >
5
5
6
6
<style >
7
7
[autoplay ] {
8
8
color : red ;
9
9
}
10
- </style >
10
+ </style >
Original file line number Diff line number Diff line change
1
+ <video ><track kind =" captions" /></video >
2
+ <video ></video >
3
+ <video ><track /></video >
4
+ <audio muted ></audio >
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "code" : " a11y-media-has-caption" ,
4
+ "end" : {
5
+ "character" : 55 ,
6
+ "column" : 15 ,
7
+ "line" : 2
8
+ },
9
+ "message" : " A11y: Media elements must have a <track kind=\" captions\" >" ,
10
+ "pos" : 40 ,
11
+ "start" : {
12
+ "character" : 40 ,
13
+ "column" : 0 ,
14
+ "line" : 2
15
+ }
16
+ },
17
+ {
18
+ "code" : " a11y-media-has-caption" ,
19
+ "end" : {
20
+ "character" : 80 ,
21
+ "column" : 24 ,
22
+ "line" : 3
23
+ },
24
+ "message" : " A11y: Media elements must have a <track kind=\" captions\" >" ,
25
+ "pos" : 56 ,
26
+ "start" : {
27
+ "character" : 56 ,
28
+ "column" : 0 ,
29
+ "line" : 3
30
+ }
31
+ }
32
+ ]
You can’t perform that action at this time.
0 commit comments