diff --git a/src/ui/Tooltip.tsx b/src/ui/Tooltip.tsx index f64905a2..8b4499a9 100644 --- a/src/ui/Tooltip.tsx +++ b/src/ui/Tooltip.tsx @@ -11,6 +11,19 @@ interface TooltipProps { className?: string } +function useIsTouchDevice() { + const [isTouchDevice, setIsTouchDevice] = React.useState(false) + + React.useEffect(() => { + setIsTouchDevice( + window.matchMedia('(hover: none)').matches || + navigator.maxTouchPoints > 0, + ) + }, []) + + return isTouchDevice +} + export function Tooltip({ children, content, @@ -19,7 +32,9 @@ export function Tooltip({ delayDuration = 200, className, }: TooltipProps) { - if (!content) { + const isTouchDevice = useIsTouchDevice() + + if (!content || isTouchDevice) { return <>{children} }