Skip to content

Commit dd626ed

Browse files
fix querySelector() to support useId()
1 parent 95c65bd commit dd626ed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const Tooltip = ({
106106
const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50)
107107

108108
useEffect(() => {
109-
const elementReference = document.querySelector(`#${anchorId}`)
109+
const elementReference = document.querySelector(`[id='${anchorId}']`)
110110

111111
if (!elementReference) {
112112
// eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -140,7 +140,7 @@ const Tooltip = ({
140140
}, [anchorId, events, delayHide, delayShow])
141141

142142
useEffect(() => {
143-
const elementReference = document.querySelector(`#${anchorId}`)
143+
const elementReference = document.querySelector(`[id='${anchorId}']`)
144144

145145
computeToolTipPosition({
146146
place,

src/components/TooltipController/TooltipController.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const TooltipController = ({
123123
return () => {}
124124
}
125125

126-
const elementReference = document.querySelector(`#${anchorId}`)
126+
const elementReference = document.querySelector(`[id='${anchorId}']`)
127127

128128
if (!elementReference) {
129129
// eslint-disable-next-line @typescript-eslint/no-empty-function

0 commit comments

Comments
 (0)