From fb2b032d735b4a9b0769eb76926f1ab3477f2741 Mon Sep 17 00:00:00 2001 From: yiekheng Date: Wed, 15 Apr 2026 22:27:57 +0800 Subject: [PATCH] Reader: broaden hover-nav detection to hybrid devices (hover: hover) matches only when the primary input is mouse-like, which excludes touch-laptops, iPads with a trackpad, and some other hybrid configurations. Switch to (any-hover: hover) plus a one-shot mousemove fallback so any mouse movement unlocks the hover-reveal behavior. Co-Authored-By: Claude Opus 4.6 (1M context) --- components/PageReader.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/PageReader.tsx b/components/PageReader.tsx index 795e413..a510875 100644 --- a/components/PageReader.tsx +++ b/components/PageReader.tsx @@ -85,7 +85,16 @@ export function PageReader({ const [canHover, setCanHover] = useState(false); const [hoveringNav, setHoveringNav] = useState(false); useEffect(() => { - setCanHover(window.matchMedia("(hover: hover)").matches); + if (window.matchMedia("(any-hover: hover)").matches) { + setCanHover(true); + return; + } + const onMove = () => { + setCanHover(true); + window.removeEventListener("mousemove", onMove); + }; + window.addEventListener("mousemove", onMove); + return () => window.removeEventListener("mousemove", onMove); }, []); const imagesRef = useRef(images);