From 6341962de473514cb481a84c07754f66196cfdf0 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 27 Mar 2025 10:43:56 -0500 Subject: [PATCH] fix(web): better touch device detection (#17144) * fix(web): better touch device detection * variable name --- web/src/lib/components/assets/thumbnail/thumbnail.svelte | 8 ++++---- web/src/lib/components/photos-page/asset-grid.svelte | 2 +- .../components/shared-components/scrubber/scrubber.svelte | 2 +- web/src/lib/stores/mobile-device.svelte.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/src/lib/components/assets/thumbnail/thumbnail.svelte b/web/src/lib/components/assets/thumbnail/thumbnail.svelte index 077eb465a2..0dbbe718ee 100644 --- a/web/src/lib/components/assets/thumbnail/thumbnail.svelte +++ b/web/src/lib/components/assets/thumbnail/thumbnail.svelte @@ -72,7 +72,7 @@ IMAGE_THUMBNAIL: { THUMBHASH_FADE_DURATION }, } = TUNABLES; - let isTouchDevice = $derived(mobileDevice.hoverNone); + let usingMobileDevice = $derived(mobileDevice.pointerCoarse); let focussableElement: HTMLElement | undefined = $state(); let mouseOver = $state(false); let loaded = $state(false); @@ -112,7 +112,7 @@ }; const onMouseEnter = () => { - if (isTouchDevice) { + if (usingMobileDevice) { return; } mouseOver = true; @@ -191,7 +191,7 @@ onfocus={handleFocus} data-testid="container-with-tabindex" > - {#if !isTouchDevice && mouseOver && !disableMouseOver} + {#if !usingMobileDevice && mouseOver && !disableMouseOver} - {#if !isTouchDevice} + {#if !usingMobileDevice}
{ element?.scrollTo({ top }); diff --git a/web/src/lib/components/shared-components/scrubber/scrubber.svelte b/web/src/lib/components/shared-components/scrubber/scrubber.svelte index 734b42205e..0fdfa9c0da 100644 --- a/web/src/lib/components/shared-components/scrubber/scrubber.svelte +++ b/web/src/lib/components/shared-components/scrubber/scrubber.svelte @@ -268,7 +268,7 @@ globalThis.removeEventListener('touchmove', onTouchMove); }; }); - const usingMobileDevice = $derived(mobileDevice.hoverNone); + const usingMobileDevice = $derived(mobileDevice.pointerCoarse);