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 {
989989 const tooltip = this . _tooltip . nativeElement ;
990990 const showClass = this . _showAnimation ;
991991 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+
9941008 this . _isVisible = isVisible ;
9951009
9961010 // 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