Look at the last commit, we made a change that fixed the touch to change pages when on…
- User
Look at the last commit, we made a change that fixed the touch to change pages when on Samsung galaxy phones. It works, touching doesn't move the page, but it does display an icon on each side of the screen when tapped
Assistant
Let me look at the click handler and the navigation arrows/icons in the paginated reader.
Assistant
Now let me find where the navigation icons/arrows are rendered.
Assistant
Now let me check the CSS for the nav arrows and whether there's any touch-specific handling.
Assistant
I see the problem. The
handleMouseMovecallback setshoverZonestate on mouse movement, and the CSS uses@media (hover: none)to hide the arrows on touch devices. But since the commit changed the JS detection to(pointer: coarse), there's now a mismatch:- JS side (
isTouchDevice): uses(pointer: coarse)— correctly identifies Samsung Galaxy as touch - CSS side (line 2610): still uses
@media (hover: none)— Samsung Galaxy with S-Pen reports hover capability, so the arrows are not hidden by CSS
Additionally, the
handleMouseMovehandler still fires on touch devices (touch events can trigger mousemove on some Android browsers), settinghoverZoneand making the arrows visible.The fix is twofold:
- Update the CSS media query to match the JS check:
(pointer: coarse)instead of(hover: none) - Guard
handleMouseMoveso it doesn't sethoverZoneon touch devices
- JS side (
Assistant
Now let me also check if
handleMouseMoveis being attached unconditionally — if so, it could still sethoverZoneon touch devices (even though CSS hides the arrows, it's cleaner to guard it).Assistant
The
handleMouseMoveis attached unconditionally. Since the CSS fix with@media (pointer: coarse)will hide the arrows viadisplay: none, the visual issue is already resolved. But to avoid unnecessary state updates on touch devices, let me add an early return inhandleMouseMove:Assistant
Now update the dependency array for
handleMouseMoveto includeisTouchDevice:Assistant
Here's a summary of the two issues and fixes:
Root cause: The last commit changed the JS
isTouchDevicecheck from(hover: none)to(pointer: coarse)to fix Samsung Galaxy S-Pen devices. But the CSS media query that hides the navigation arrows was still using@media (hover: none). Since Samsung Galaxy (especially with S-Pen) reports hover capability, the CSS didn't match, and the arrow icons remained visible on tap.Fixes:
-
CSS media query (line ~2610): Changed
@media (hover: none)to@media (pointer: coarse)so it matches the same devices as the JS check. This hides the nav arrows on Samsung Galaxy and other touch devices. -
handleMouseMoveguard (line ~1479): Addedif (isTouchDevice) return;early exit so touch-emulated mouse events don't sethoverZonestate unnecessarily on touch devices.
-