From e2d5f09b70bdf39a580586a164268830327859d2 Mon Sep 17 00:00:00 2001 From: sezzim <174854242+sezzim@users.noreply.github.com> Date: Sat, 10 Jan 2026 14:08:52 -0800 Subject: [PATCH] Suppress tap navigation concurrent with swipe navigation --- ui/v2.5/src/hooks/Lightbox/Lightbox.tsx | 6 +++++- ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx index e67b85e92..7d0f8d073 100644 --- a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx +++ b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx @@ -144,16 +144,20 @@ const LightboxCarousel = forwardRef(function ( event: React.PointerEvent, swipeDuration: number, cancelled: boolean - ) { + ): boolean { const cappedDuration = Math.max(50, Math.min(500, swipeDuration)) / 1000; const adjustedShift = carouselShift / (2 * cappedDuration); + let changed = false; if (!cancelled && adjustedShift < -window.innerWidth / 2) { handleRight(); + changed = true; } else if (!cancelled && adjustedShift > window.innerWidth / 2) { handleLeft(); + changed = true; } setCarouselShift(0); overrideTransition(CLASSNAME_SWIPE); + return changed; } return ( diff --git a/ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx b/ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx index f223aec35..2cd2a34a7 100644 --- a/ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx +++ b/ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx @@ -107,7 +107,7 @@ interface IProps { ev: React.PointerEvent, swipeDuration: number, cancelled: boolean - ) => void; + ) => boolean; isVideo: boolean; } @@ -501,8 +501,10 @@ export const LightboxImage: React.FC = ({ } if (ev.pointerType === "touch" && startPoint.current !== null) { - // Swipe navigation - releaseCarousel(ev, ev.timeStamp - startTime.current, false); + // Swipe navigation, returns true if actually moved to another image. + if (releaseCarousel(ev, ev.timeStamp - startTime.current, false)) { + return; + } } if (