File tree Expand file tree Collapse file tree 4 files changed +50
-14
lines changed
material-experimental/mdc-progress-bar Expand file tree Collapse file tree 4 files changed +50
-14
lines changed Original file line number Diff line number Diff line change 1
- < div class ="mdc-linear-progress ">
1
+ <!--
2
+ All children need to be hidden for screen readers in order to support ChromeVox.
3
+ More context in the issue: https://github.com/angular/components/issues/22165.
4
+ -->
5
+ < div class ="mdc-linear-progress " aria-hidden ="true ">
2
6
< div class ="mdc-linear-progress__buffer ">
3
7
< div class ="mdc-linear-progress__buffer-bar "> </ div >
4
8
< div class ="mdc-linear-progress__buffer-dots "> </ div >
Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ describe('MDC-based MatProgressBar', () => {
17
17
return TestBed . createComponent < T > ( componentType ) ;
18
18
}
19
19
20
+ // All children need to be hidden for screen readers in order to support ChromeVox.
21
+ // More context in the issue: https://github.com/angular/components/issues/22165.
22
+ it ( 'should have elements wrapped in aria-hidden div' , ( ) => {
23
+ const fixture = createComponent ( BasicProgressBar ) ;
24
+ const host = fixture . nativeElement as Element ;
25
+ const element = host . children [ 0 ] ;
26
+ expect ( element . children . length ) . toBe ( 1 ) ;
27
+
28
+ const div = element . querySelector ( 'div' ) ! ;
29
+ expect ( div ) . toBeTruthy ( ) ;
30
+ expect ( div . getAttribute ( 'aria-hidden' ) ) . toBe ( 'true' ) ;
31
+ } ) ;
32
+
20
33
describe ( 'with animation' , ( ) => {
21
34
describe ( 'basic progress-bar' , ( ) => {
22
35
it ( 'should apply a mode of "determinate" if no mode is provided.' , ( ) => {
Original file line number Diff line number Diff line change 1
1
<!--
2
- The background div is named as such because it appears below the other divs and is not sized based
3
- on values .
2
+ All children need to be hidden for screen readers in order to support ChromeVox.
3
+ More context in the issue: https://github.com/angular/components/issues/22165 .
4
4
-->
5
- < svg width ="100% " height ="4 " focusable ="false " class ="mat-progress-bar-background mat-progress-bar-element ">
6
- < defs >
7
- < pattern [id] ="progressbarId " x ="4 " y ="0 " width ="8 " height ="4 " patternUnits ="userSpaceOnUse ">
8
- < circle cx ="2 " cy ="2 " r ="2 "/>
9
- </ pattern >
10
- </ defs >
11
- < rect [attr.fill] ="_rectangleFillValue " width ="100% " height ="100% "/>
12
- </ svg >
13
- < div class ="mat-progress-bar-buffer mat-progress-bar-element " [ngStyle] ="_bufferTransform() "> </ div >
14
- < div class ="mat-progress-bar-primary mat-progress-bar-fill mat-progress-bar-element " [ngStyle] ="_primaryTransform() " #primaryValueBar > </ div >
15
- < div class ="mat-progress-bar-secondary mat-progress-bar-fill mat-progress-bar-element "> </ div >
5
+ < div aria-hidden ="true ">
6
+ < svg width ="100% " height ="4 " focusable ="false " class ="mat-progress-bar-background mat-progress-bar-element ">
7
+ < defs >
8
+ < pattern [id] ="progressbarId " x ="4 " y ="0 " width ="8 " height ="4 " patternUnits ="userSpaceOnUse ">
9
+ < circle cx ="2 " cy ="2 " r ="2 "/>
10
+ </ pattern >
11
+ </ defs >
12
+ < rect [attr.fill] ="_rectangleFillValue " width ="100% " height ="100% "/>
13
+ </ svg >
14
+ <!--
15
+ The background div is named as such because it appears below the other divs and is not sized based
16
+ on values.
17
+ -->
18
+ < div class ="mat-progress-bar-buffer mat-progress-bar-element " [ngStyle] ="_bufferTransform() "> </ div >
19
+ < div class ="mat-progress-bar-primary mat-progress-bar-fill mat-progress-bar-element " [ngStyle] ="_primaryTransform() " #primaryValueBar > </ div >
20
+ < div class ="mat-progress-bar-secondary mat-progress-bar-fill mat-progress-bar-element "> </ div >
21
+ </ div >
Original file line number Diff line number Diff line change @@ -25,6 +25,19 @@ describe('MatProgressBar', () => {
25
25
return TestBed . createComponent < T > ( componentType ) ;
26
26
}
27
27
28
+ // All children need to be hidden for screen readers in order to support ChromeVox.
29
+ // More context in the issue: https://github.com/angular/components/issues/22165.
30
+ it ( 'should have elements wrapped in aria-hidden div' , ( ) => {
31
+ const fixture = createComponent ( BasicProgressBar ) ;
32
+ const host = fixture . nativeElement as Element ;
33
+ const element = host . children [ 0 ] ;
34
+ expect ( element . children . length ) . toBe ( 1 ) ;
35
+
36
+ const div = element . querySelector ( 'div' ) ! ;
37
+ expect ( div ) . toBeTruthy ( ) ;
38
+ expect ( div . getAttribute ( 'aria-hidden' ) ) . toBe ( 'true' ) ;
39
+ } ) ;
40
+
28
41
describe ( 'with animation' , ( ) => {
29
42
describe ( 'basic progress-bar' , ( ) => {
30
43
it ( 'should apply a mode of "determinate" if no mode is provided.' , ( ) => {
You can’t perform that action at this time.
0 commit comments