We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76a601a commit 68997f9Copy full SHA for 68997f9
src/ui/Tooltip.tsx
@@ -11,6 +11,19 @@ interface TooltipProps {
11
className?: string
12
}
13
14
+function useIsTouchDevice() {
15
+ const [isTouchDevice, setIsTouchDevice] = React.useState(false)
16
+
17
+ React.useEffect(() => {
18
+ setIsTouchDevice(
19
+ window.matchMedia('(hover: none)').matches ||
20
+ navigator.maxTouchPoints > 0,
21
+ )
22
+ }, [])
23
24
+ return isTouchDevice
25
+}
26
27
export function Tooltip({
28
children,
29
content,
@@ -19,7 +32,9 @@ export function Tooltip({
32
delayDuration = 200,
33
className,
34
}: TooltipProps) {
- if (!content) {
35
+ const isTouchDevice = useIsTouchDevice()
36
37
+ if (!content || isTouchDevice) {
38
return <>{children}</>
39
40
0 commit comments