From e2177cd23ece55a85c003f6913e3acfd49e62d67 Mon Sep 17 00:00:00 2001 From: srikant Date: Wed, 7 Feb 2024 03:05:19 +0530 Subject: [PATCH] #1685 : Set tooltip visible based on closest for link click (#1686) --- canvas_modules/common-canvas/src/tooltip/tooltip.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/canvas_modules/common-canvas/src/tooltip/tooltip.jsx b/canvas_modules/common-canvas/src/tooltip/tooltip.jsx index 05661935ba..5b178f0252 100644 --- a/canvas_modules/common-canvas/src/tooltip/tooltip.jsx +++ b/canvas_modules/common-canvas/src/tooltip/tooltip.jsx @@ -351,8 +351,15 @@ class ToolTip extends React.Component { if (this.tabKeyPressed) { this.setTooltipVisible(false); this.tabKeyPressed = false; - } else if (evt.relatedTarget === null) { // Keep tooltip visible when clicked on a link. - this.setTooltipVisible(false); + } else { + // Check if evt.relatedTarget is a child of .common-canvas-tooltip to set tooltip visible when clicked on link + const el = evt?.relatedTarget?.closest(".common-canvas-tooltip"); + if (el?.tagName?.toLowerCase() === "div") { + this.setTooltipVisible(true); + } else { + // Close the tooltip if evt.relatedTarget is not a child of .common-canvas-tooltip + this.setTooltipVisible(false); + } } }; const click = (evt) => this.toggleTooltipOnClick(evt);