Skip to content

Commit ff78ade

Browse files
crisbetoandrewseguin
authored andcommitted
fix(progress-bar): not usable in high contrast mode (#11651)
Fixes the progress bar component being completely invisible in high contrast mode. Fixes #11623.
1 parent 6220b72 commit ff78ade

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/lib/progress-bar/progress-bar.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import '../core/style/variables';
22
@import '../core/style/vendor-prefixes';
33
@import '../core/style/noop-animation';
4+
@import '../../cdk/a11y/a11y';
45

56
$mat-progress-bar-height: 5px !default;
67
$mat-progress-bar-full-animation-duration: 2000ms !default;
@@ -30,6 +31,10 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
3031
// The width is set to be 10px longer than the container as it will be translated 10px
3132
// during the background scroll animation.
3233
width: calc(100% + 10px);
34+
35+
@include cdk-high-contrast {
36+
display: none;
37+
}
3338
}
3439

3540
// The progress bar buffer is the bar indicator showing the buffer value and is only visible
@@ -38,6 +43,11 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
3843
@include _noop-animation();
3944
transform-origin: top left;
4045
transition: transform $mat-progress-bar-piece-animation-duration ease;
46+
47+
@include cdk-high-contrast {
48+
border-top: solid 5px;
49+
opacity: 0.5;
50+
}
4151
}
4252

4353
// The secondary progress bar is only used in the indeterminate animation, because of this it
@@ -52,6 +62,10 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
5262
animation: none;
5363
transform-origin: top left;
5464
transition: transform $mat-progress-bar-piece-animation-duration ease;
65+
66+
@include cdk-high-contrast {
67+
border-top: solid $mat-progress-bar-height;
68+
}
5569
}
5670

5771
// A pseudo element is created for each progress bar bar that fills with the indicator color.
@@ -124,6 +138,10 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
124138
@include backface-visibility(hidden);
125139
animation: mat-progress-bar-background-scroll
126140
$mat-progress-bar-piece-animation-duration infinite linear;
141+
142+
// Needs to be explicit here so it can overwrite the `display: none`
143+
// in all other variants in high contrast mode.
144+
display: block;
127145
}
128146
}
129147
}

0 commit comments

Comments
 (0)