Skip to content

Commit

Permalink
RG-2490 support moving cursor from anchor to tooltip (#7754)
Browse files Browse the repository at this point in the history
* RG-2490 support moving cursor from anchor to tooltip

* RG-2490 use React for "mouseout" event
  • Loading branch information
andrey-skl authored Sep 23, 2024
1 parent e41ec76 commit 053e9a9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ export default class Tooltip extends Component<TooltipProps> {
addListeners() {
if (this.containerNode != null) {
this.listeners.add(this.containerNode, 'mouseover', this.tryToShowPopup);
this.listeners.add(this.containerNode, 'mouseout', this.hidePopup);
this.listeners.add(this.containerNode, 'mouseout', ev => {
if (ev.relatedTarget && this.popup?.container?.contains(ev.relatedTarget as Node)) {
return;
}

this.hidePopup();
});
}
this.listeners.add(document, 'scroll', () => scheduleScroll(this.hidePopup), {passive: true});
}
Expand Down Expand Up @@ -178,6 +184,7 @@ export default class Tooltip extends Component<TooltipProps> {
maxHeight={400}
className={classNames(styles.tooltip, {[styles.long]: long})}
attached={false}
onMouseOut={this.hidePopup}
top={4}
dontCloseOnAnchorClick
ref={this.popupRef}
Expand Down

0 comments on commit 053e9a9

Please sign in to comment.