Skip to content

Commit

Permalink
#1685 : Set tooltip visible based on closest for link click (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
srikant-ch5 authored Feb 6, 2024
1 parent df5f0a5 commit e2177cd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions canvas_modules/common-canvas/src/tooltip/tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e2177cd

Please sign in to comment.