Skip to content

Commit

Permalink
Fix #6008: Tooltip allow onBeforeHide to prevent hiding (#7591)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 10, 2025
1 parent 7025306 commit 616abec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/lib/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ export const Tooltip = React.memo(

clearTimeouts();

let success = true;

if (visibleState) {
const success = sendCallback(props.onBeforeHide, { originalEvent: e, target: currentTargetRef.current });
success = sendCallback(props.onBeforeHide, { originalEvent: e, target: currentTargetRef.current });

if (success) {
applyDelay('hideDelay', () => {
Expand All @@ -225,7 +227,9 @@ export const Tooltip = React.memo(
}

// handles the case when visibleState change from mouseenter was queued and mouseleave handler was called earlier than queued re-render
setVisibleState(false);
if (success) {
setVisibleState(false);
}
};

const align = (target, coordinate, position) => {
Expand Down

0 comments on commit 616abec

Please sign in to comment.