Skip to content

Commit eb96b0c

Browse files
crisbetokara
authored andcommitted
fix(progress-bar): unable to apply visibility in indeterminate mode and reduce CSS (#2417)
Fixes #2413.
1 parent bdc48a8 commit eb96b0c

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
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 & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
@import '../core/style/variables';
2-
3-
41
$md-progress-bar-height: 5px !default;
52
$md-progress-bar-full-animation-duration: 2000ms !default;
63
$md-progress-bar-piece-animation-duration: 250ms !default;
@@ -17,51 +14,46 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
1714
transition: opacity $md-progress-bar-piece-animation-duration linear;
1815
width: 100%;
1916

17+
// Base styles that are re-used across all of the progress bar children.
18+
.md-progress-bar-element, .md-progress-bar-fill::after {
19+
height: 100%;
20+
position: absolute;
21+
width: 100%;
22+
}
23+
2024
// The progress bar background is used to show the bubble animation scrolling behind a
2125
// buffering progress bar.
2226
.md-progress-bar-background {
2327
background-repeat: repeat-x;
2428
background-size: 10px 4px;
25-
height: 100%;
26-
position: absolute;
27-
visibility: hidden;
28-
width: 100%;
29+
display: none;
2930
}
3031

3132
// The progress bar buffer is the bar indicator showing the buffer value and is only visible
3233
// beyond the current value of the primary progress bar.
3334
.md-progress-bar-buffer {
34-
height: 100%;
35-
position: absolute;
3635
transform-origin: top left;
3736
transition: transform $md-progress-bar-piece-animation-duration ease;
38-
width: 100%;
3937
}
4038

41-
// The secondary progress bar is only used in the indeterminate animation, because of this it
42-
// is hidden in other uses.
39+
// The secondary progress bar is only used in the indeterminate animation, because of this it
40+
// is hidden in other uses.
4341
.md-progress-bar-secondary {
44-
visibility: hidden;
42+
display: none;
4543
}
4644

4745
// The progress bar fill fills the progress bar with the indicator color.
4846
.md-progress-bar-fill {
4947
animation: none;
50-
height: 100%;
51-
position: absolute;
5248
transform-origin: top left;
5349
transition: transform $md-progress-bar-piece-animation-duration ease;
54-
width: 100%;
5550
}
5651

5752
// A pseudo element is created for each progress bar bar that fills with the indicator color.
5853
.md-progress-bar-fill::after {
5954
animation: none;
6055
content: '';
6156
display: inline-block;
62-
height: 100%;
63-
position: absolute;
64-
width: 100%;
6557
left: 0;
6658
}
6759

@@ -84,7 +76,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
8476
.md-progress-bar-secondary {
8577
animation: md-progress-bar-secondary-indeterminate-translate $md-progress-bar-full-animation-duration infinite linear;
8678
left: -54.888891%;
87-
visibility: visible;
79+
display: block;
8880
}
8981
.md-progress-bar-secondary.md-progress-bar-fill::after {
9082
animation: md-progress-bar-secondary-indeterminate-scale $md-progress-bar-full-animation-duration infinite linear;
@@ -94,7 +86,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
9486
&[mode='buffer'] {
9587
.md-progress-bar-background {
9688
animation: md-progress-bar-background-scroll $md-progress-bar-piece-animation-duration infinite linear;
97-
visibility: visible;
89+
display: block;
9890
}
9991
}
10092
}
@@ -114,7 +106,7 @@ $md-progress-bar-piece-animation-duration: 250ms !default;
114106
// mirrors the primary progress bar in appearance but is only shown to assist with the
115107
// indeterminate animations.
116108

117-
// KEYFRAME BLOCK DESCRIPTION
109+
// KEYFRAME BLOCK DESCRIPTION
118110
// primary-indeterminate-translate Translation of the primary progressbar across the screen
119111
// primary-indeterminate-scale Scaling of the primary bar as it's being translated across the screen
120112
// secondary-indeterminate-translate Translation of the secondary bar across the screen

0 commit comments

Comments
 (0)