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 @@ -1018,8 +1018,22 @@ export abstract class _TooltipComponentBase implements OnDestroy {
1018
1018
const tooltip = this . _tooltip . nativeElement ;
1019
1019
const showClass = this . _showAnimation ;
1020
1020
const hideClass = this . _hideAnimation ;
1021
- tooltip . classList . remove ( isVisible ? hideClass : showClass ) ;
1022
- tooltip . classList . add ( isVisible ? showClass : hideClass ) ;
1021
+
1022
+ if ( isVisible ) {
1023
+ tooltip . classList . remove ( hideClass ) ;
1024
+ tooltip . classList . add ( showClass ) ;
1025
+ }
1026
+
1027
+ if ( ! isVisible ) {
1028
+ // It's avoids the problem when `mat-tooltip-hide` triggers the animation of
1029
+ // a tooltip that has not been shown yet.
1030
+ if ( tooltip . classList . contains ( showClass ) ) {
1031
+ tooltip . classList . add ( hideClass ) ;
1032
+ }
1033
+
1034
+ tooltip . classList . remove ( showClass ) ;
1035
+ }
1036
+
1023
1037
this . _isVisible = isVisible ;
1024
1038
1025
1039
// 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