From 7fdbe508c6a240b1db74adf74fbf8ddffe907010 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:08:42 +0100 Subject: [PATCH] Use getBoundingClientRect as a fallback --- src/components/Tooltip/BaseTooltip.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Tooltip/BaseTooltip.js b/src/components/Tooltip/BaseTooltip.js index f8d1cf87fc42..50ade2026bae 100644 --- a/src/components/Tooltip/BaseTooltip.js +++ b/src/components/Tooltip/BaseTooltip.js @@ -48,10 +48,8 @@ function chooseBoundingBox(target, clientX, clientY) { } } - // If no matching bounding box is found, fall back to the first one. - // This could only happen if the user is moving the mouse very quickly - // and they got it outside our slop above. - return bbs[0]; + // If no matching bounding box is found, fall back to getBoundingClientRect. + return target.getBoundingClientRect(); } function Tooltip({children, numberOfLines, maxWidth, text, renderTooltipContent, renderTooltipContentKey, shouldHandleScroll, shiftHorizontal, shiftVertical}) {