File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -93,15 +93,17 @@ export class RippleRenderer {
93
93
94
94
// If the color is not set, the default CSS color will be used.
95
95
ripple . style . backgroundColor = config . color ;
96
+ ripple . style . transitionDuration = `${ duration } s` ;
96
97
97
98
this . _targetElement . appendChild ( ripple ) ;
98
99
99
- // Wait for the next tick because for elements the CSS transition isn't applied
100
- // immediately and otherwise the ripple would just expand without any animation.
101
- this . runTimeoutOutsideZone ( ( ) => {
102
- ripple . style . transitionDuration = `${ duration } s` ;
103
- ripple . style . transform = 'scale(1)' ;
104
- } , 1 ) ;
100
+ // By default the browser does not recalculate the styles of dynamically created
101
+ // ripple elements. This is critical because then the `scale` would not animate properly.
102
+ // Enforce a style recalculation by calling `getComputedStyle` and accessing any property.
103
+ // See: https://gist.github.com/paulirish/5d52fb081b3570c81e3a
104
+ window . getComputedStyle ( ripple ) . getPropertyValue ( 'opacity' ) ;
105
+
106
+ ripple . style . transform = 'scale(1)' ;
105
107
106
108
// Wait for the ripple to be faded in. Once faded in the ripple can be hided if the mouse is
107
109
// released.
You can’t perform that action at this time.
0 commit comments