From 6acea4fc9c9b4eaee8d6f7821f9341e845d050b0 Mon Sep 17 00:00:00 2001 From: Andrey Skladchikov Date: Mon, 23 Sep 2024 15:00:18 +0200 Subject: [PATCH] RG-2490 support moving cursor from anchor to tooltip --- src/tooltip/tooltip.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tooltip/tooltip.tsx b/src/tooltip/tooltip.tsx index 57b56ac5aa7..bcea8ed9687 100644 --- a/src/tooltip/tooltip.tsx +++ b/src/tooltip/tooltip.tsx @@ -133,7 +133,14 @@ export default class Tooltip extends Component { 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)) { + this.listeners.add(this.popup?.container, 'mouseout', this.hidePopup); + return; + } + + this.hidePopup(); + }); } this.listeners.add(document, 'scroll', () => scheduleScroll(this.hidePopup), {passive: true}); }