diff --git a/libs/shared/lib/components/tooltip/Tooltip.tsx b/libs/shared/lib/components/tooltip/Tooltip.tsx index 57555943336979e209dbb8244530e04441e20aef..a5afb88b23fa8f149f8d1c1bca51cd13b2dd63af 100644 --- a/libs/shared/lib/components/tooltip/Tooltip.tsx +++ b/libs/shared/lib/components/tooltip/Tooltip.tsx @@ -119,11 +119,12 @@ export const TooltipTrigger = React.forwardRef<HTMLElement, React.HTMLProps<HTML React.useEffect(() => { if (x == null) return; - if (x && y) { - context.data.refs.reference.current.style.transform = `translate(${x}px, ${y}px)`; + if (x && y && context.data.refs.reference.current != null) { + const element = context.data.refs.reference.current as HTMLElement; + element.style.position = 'absolute'; + element.style.transform = `translate(${x}px, ${y}px)`; + context.data.update(); } - - context.data.update(); }, [x, y]); // `asChild` allows the user to pass any element as the anchor