File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -989,8 +989,22 @@ export abstract class _TooltipComponentBase implements OnDestroy {
989
989
const tooltip = this . _tooltip . nativeElement ;
990
990
const showClass = this . _showAnimation ;
991
991
const hideClass = this . _hideAnimation ;
992
- tooltip . classList . remove ( isVisible ? hideClass : showClass ) ;
993
- tooltip . classList . add ( isVisible ? showClass : hideClass ) ;
992
+
993
+ if ( isVisible ) {
994
+ tooltip . classList . remove ( hideClass ) ;
995
+ tooltip . classList . add ( showClass ) ;
996
+ }
997
+
998
+ if ( ! isVisible ) {
999
+ // It's avoids the problem when `mat-tooltip-hide` triggers the animation of
1000
+ // a tooltip that has not been shown yet.
1001
+ if ( tooltip . classList . contains ( showClass ) ) {
1002
+ tooltip . classList . add ( hideClass ) ;
1003
+ }
1004
+
1005
+ tooltip . classList . remove ( showClass ) ;
1006
+ }
1007
+
994
1008
this . _isVisible = isVisible ;
995
1009
996
1010
// It's common for internal apps to disable animations using `* { animation: none !important }`
You can’t perform that action at this time.
0 commit comments