Skip to content

Commit 7bf81ac

Browse files
committed
fix(progress-bar): unable to apply visibility in indeterminate mode and reduce CSS
* Fixes being unable to apply `visibility: hidden` to progress bars in `indeterminate` or `buffer` mode. * Slightly reduces the amount of CSS used for the `progress-bar` component. Fixes #2413.
1 parent 026c70a commit 7bf81ac

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- The background div is named as such because it appears below the other divs and is not sized based on values. -->
2-
<div class="md-progress-bar-background"></div>
3-
<div class="md-progress-bar-buffer" [ngStyle]="_bufferTransform()"></div>
4-
<div class="md-progress-bar-primary md-progress-bar-fill" [ngStyle]="_primaryTransform()"></div>
5-
<div class="md-progress-bar-secondary md-progress-bar-fill"></div>
2+
<div class="md-progress-bar-background md-progress-bar-element"></div>
3+
<div class="md-progress-bar-buffer md-progress-bar-element" [ngStyle]="_bufferTransform()"></div>
4+
<div class="md-progress-bar-primary md-progress-bar-fill md-progress-bar-element" [ngStyle]="_primaryTransform()"></div>
5+
<div class="md-progress-bar-secondary md-progress-bar-fill md-progress-bar-element"></div>

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,46 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
1717
transition: opacity $md-progress-bar-piece-animation-duration linear;
1818
width: 100%;
1919

20+
// Base styles that are re-used across all of the progress bar children.
21+
.md-progress-bar-element, .md-progress-bar-fill::after {
22+
height: 100%;
23+
position: absolute;
24+
width: 100%;
25+
}
26+
2027
// The progress bar background is used to show the bubble animation scrolling behind a
2128
// buffering progress bar.
2229
.md-progress-bar-background {
2330
background-repeat: repeat-x;
2431
background-size: 10px 4px;
25-
height: 100%;
26-
position: absolute;
27-
visibility: hidden;
28-
width: 100%;
32+
display: none;
2933
}
3034

3135
// The progress bar buffer is the bar indicator showing the buffer value and is only visible
3236
// beyond the current value of the primary progress bar.
3337
.md-progress-bar-buffer {
34-
height: 100%;
35-
position: absolute;
3638
transform-origin: top left;
3739
transition: transform $md-progress-bar-piece-animation-duration ease;
38-
width: 100%;
3940
}
4041

41-
// The secondary progress bar is only used in the indeterminate animation, because of this it
42-
// is hidden in other uses.
42+
// The secondary progress bar is only used in the indeterminate animation, because of this it
43+
// is hidden in other uses.
4344
.md-progress-bar-secondary {
44-
visibility: hidden;
45+
display: none;
4546
}
4647

4748
// The progress bar fill fills the progress bar with the indicator color.
4849
.md-progress-bar-fill {
4950
animation: none;
50-
height: 100%;
51-
position: absolute;
5251
transform-origin: top left;
5352
transition: transform $md-progress-bar-piece-animation-duration ease;
54-
width: 100%;
5553
}
5654

5755
// A pseudo element is created for each progress bar bar that fills with the indicator color.
5856
.md-progress-bar-fill::after {
5957
animation: none;
6058
content: '';
6159
display: inline-block;
62-
height: 100%;
63-
position: absolute;
64-
width: 100%;
6560
left: 0;
6661
}
6762

@@ -84,7 +79,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
8479
.md-progress-bar-secondary {
8580
animation: md-progress-bar-secondary-indeterminate-translate $md-progress-bar-full-animation-duration infinite linear;
8681
left: -54.888891%;
87-
visibility: visible;
82+
display: block;
8883
}
8984
.md-progress-bar-secondary.md-progress-bar-fill::after {
9085
animation: md-progress-bar-secondary-indeterminate-scale $md-progress-bar-full-animation-duration infinite linear;
@@ -94,7 +89,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
9489
&[mode='buffer'] {
9590
.md-progress-bar-background {
9691
animation: md-progress-bar-background-scroll $md-progress-bar-piece-animation-duration infinite linear;
97-
visibility: visible;
92+
display: block;
9893
}
9994
}
10095
}
@@ -114,7 +109,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
114109
// mirrors the primary progress bar in appearance but is only shown to assist with the
115110
// indeterminate animations.
116111

117-
// KEYFRAME BLOCK DESCRIPTION
112+
// KEYFRAME BLOCK DESCRIPTION
118113
// primary-indeterminate-translate Translation of the primary progressbar across the screen
119114
// primary-indeterminate-scale Scaling of the primary bar as it's being translated across the screen
120115
// secondary-indeterminate-translate Translation of the secondary bar across the screen

0 commit comments

Comments
 (0)