File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -93,15 +93,17 @@ export class RippleRenderer {
9393
9494 // If the color is not set, the default CSS color will be used.
9595 ripple . style . backgroundColor = config . color ;
96+ ripple . style . transitionDuration = `${ duration } s` ;
9697
9798 this . _targetElement . appendChild ( ripple ) ;
9899
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)' ;
105107
106108 // Wait for the ripple to be faded in. Once faded in the ripple can be hided if the mouse is
107109 // released.
You can’t perform that action at this time.
0 commit comments