@@ -277,6 +277,7 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
277277
278278 private _destroy$ = new Subject < void > ( ) ;
279279 private _autoHideDelay = 180 ;
280+ private _isForceClosed = false ;
280281
281282 constructor ( private _element : ElementRef ,
282283 @Optional ( ) private _navigationService : IgxNavigationService , private _viewContainerRef : ViewContainerRef ) {
@@ -303,6 +304,7 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
303304 }
304305
305306 this . _checkOutletAndOutsideClick ( ) ;
307+ this . _checkTooltipForMultipleTargets ( ) ;
306308 this . _showOnInteraction ( ) ;
307309 }
308310
@@ -311,10 +313,6 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
311313 */
312314 @HostListener ( 'mouseleave' )
313315 public onMouseLeave ( ) {
314- if ( this . sticky ) {
315- return ;
316- }
317-
318316 if ( this . tooltipDisabled ) {
319317 return ;
320318 }
@@ -433,10 +431,14 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
433431 }
434432
435433 private _showTooltip ( withDelay : boolean , withEvents : boolean ) : void {
436- if ( ! this . target . collapsed ) {
434+ if ( ! this . target . collapsed && ! this . _isForceClosed ) {
437435 return ;
438436 }
439437
438+ if ( this . _isForceClosed ) {
439+ this . _isForceClosed = false ;
440+ }
441+
440442 if ( withEvents ) {
441443 const showingArgs = { target : this , tooltip : this . target , cancel : false } ;
442444 this . tooltipShow . emit ( showingArgs ) ;
@@ -457,7 +459,7 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
457459 }
458460
459461 private _hideOnInteraction ( ) : void {
460- if ( ! this . target . sticky ) {
462+ if ( ! this . sticky ) {
461463 this . _setAutoHide ( ) ;
462464 }
463465 }
@@ -470,8 +472,31 @@ export class IgxTooltipTargetDirective extends IgxToggleActionDirective implemen
470472 } , this . _autoHideDelay ) ;
471473 }
472474
475+ /**
476+ * Used when the browser animations are set to a lower percentage
477+ * and the user interacts with the target or tooltip __while__ an animation is playing.
478+ * It stops the running animation, and the tooltip is instantly shown.
479+ */
473480 private _stopTimeoutAndAnimation ( ) : void {
474481 clearTimeout ( this . target . timeoutId ) ;
475482 this . target . stopAnimations ( ) ;
476483 }
484+
485+ /**
486+ * Used when a single tooltip is used for multiple targets.
487+ * If the tooltip is shown for one target and the user interacts with another target,
488+ * the tooltip is instantly hidden for the first target.
489+ */
490+ private _checkTooltipForMultipleTargets ( ) : void {
491+ if ( ! this . target . tooltipTarget ) {
492+ this . target . tooltipTarget = this ;
493+ }
494+
495+ if ( this . target . tooltipTarget !== this ) {
496+ clearTimeout ( this . target . timeoutId ) ;
497+ this . target . stopAnimations ( true ) ;
498+ this . target . tooltipTarget = this ;
499+ this . _isForceClosed = true ;
500+ }
501+ }
477502}
0 commit comments