This is an automated email from the ASF dual-hosted git repository.

rfellows pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 3ab60859ea NIFI-13855: Ensuring that tooltips get closed when the host 
component is clicked. (#9376)
3ab60859ea is described below

commit 3ab60859ea629e9858de56ff001029cee4db9024
Author: Matt Gilman <[email protected]>
AuthorDate: Fri Oct 11 12:15:08 2024 -0400

    NIFI-13855: Ensuring that tooltips get closed when the host component is 
clicked. (#9376)
    
    This closes #9376
---
 .../src/directives/nifi-tooltip.directive.ts       | 45 +++++++++++++---------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git 
a/nifi-frontend/src/main/frontend/libs/shared/src/directives/nifi-tooltip.directive.ts
 
b/nifi-frontend/src/main/frontend/libs/shared/src/directives/nifi-tooltip.directive.ts
index c283e350ac..0a4d7c50f4 100644
--- 
a/nifi-frontend/src/main/frontend/libs/shared/src/directives/nifi-tooltip.directive.ts
+++ 
b/nifi-frontend/src/main/frontend/libs/shared/src/directives/nifi-tooltip.directive.ts
@@ -59,8 +59,35 @@ export class NifiTooltipDirective<T> implements OnDestroy {
         }
     }
 
+    @HostListener('mousemove')
+    mouseMove() {
+        if (this.overlayRef?.hasAttached() && this.tooltipDisabled) {
+            this.overlayRef?.detach();
+
+            if (this.positionStrategy?.detach) {
+                this.positionStrategy.detach();
+            }
+        }
+    }
+
+    @HostListener('mouseup')
+    mouseup() {
+        if (!this.overlayRef?.hasAttached()) {
+            this.attach();
+        }
+    }
+
     @HostListener('mouseleave')
     mouseLeave() {
+        this.closeTip();
+    }
+
+    @HostListener('click')
+    click() {
+        this.closeTip();
+    }
+
+    private closeTip(): void {
         if (this.overlayRef?.hasAttached() && !this.overTip) {
             if (this.delayClose) {
                 this.closeTimer = window.setTimeout(() => {
@@ -87,24 +114,6 @@ export class NifiTooltipDirective<T> implements OnDestroy {
         }
     }
 
-    @HostListener('mousemove')
-    mouseMove() {
-        if (this.overlayRef?.hasAttached() && this.tooltipDisabled) {
-            this.overlayRef?.detach();
-
-            if (this.positionStrategy?.detach) {
-                this.positionStrategy.detach();
-            }
-        }
-    }
-
-    @HostListener('mouseup')
-    mouseup() {
-        if (!this.overlayRef?.hasAttached()) {
-            this.attach();
-        }
-    }
-
     ngOnDestroy(): void {
         this.overlayRef?.dispose();
         this.positionStrategy?.dispose();

Reply via email to