From dd626ed06fd45c6c522e04cc8c867c795a7385b7 Mon Sep 17 00:00:00 2001 From: gabrieljablonski Date: Thu, 8 Dec 2022 00:40:02 -0300 Subject: [PATCH] fix `querySelector()` to support `useId()` --- src/components/Tooltip/Tooltip.tsx | 4 ++-- src/components/TooltipController/TooltipController.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 67a6d3ee7..09b09847d 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -106,7 +106,7 @@ const Tooltip = ({ const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50) useEffect(() => { - const elementReference = document.querySelector(`#${anchorId}`) + const elementReference = document.querySelector(`[id='${anchorId}']`) if (!elementReference) { // eslint-disable-next-line @typescript-eslint/no-empty-function @@ -140,7 +140,7 @@ const Tooltip = ({ }, [anchorId, events, delayHide, delayShow]) useEffect(() => { - const elementReference = document.querySelector(`#${anchorId}`) + const elementReference = document.querySelector(`[id='${anchorId}']`) computeToolTipPosition({ place, diff --git a/src/components/TooltipController/TooltipController.tsx b/src/components/TooltipController/TooltipController.tsx index 79e322341..8cc7f0cbf 100644 --- a/src/components/TooltipController/TooltipController.tsx +++ b/src/components/TooltipController/TooltipController.tsx @@ -123,7 +123,7 @@ const TooltipController = ({ return () => {} } - const elementReference = document.querySelector(`#${anchorId}`) + const elementReference = document.querySelector(`[id='${anchorId}']`) if (!elementReference) { // eslint-disable-next-line @typescript-eslint/no-empty-function