Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/ui/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,7 +32,9 @@ export function Tooltip({
delayDuration = 200,
className,
}: TooltipProps) {
if (!content) {
const isTouchDevice = useIsTouchDevice()

if (!content || isTouchDevice) {
return <>{children}</>
}

Expand Down
Loading