Clicking the black bars around the image (a missed arrow click) closed the lightbox and dropped the guest back into the grid. The lightbox now only closes via the X button or Escape, matching what gallery guests expect while paging through photos. Co-authored-by: Paul Nothaft <[email protected]>
This commit is contained in:
co-authored by
Paul Nothaft
parent
d41cd9746d
commit
34c2992521
@@ -407,13 +407,6 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleImageClick = (e: React.MouseEvent) => {
|
|
||||||
// Only close if clicking the background, not the image
|
|
||||||
if (e.target === e.currentTarget) {
|
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Touch event handlers: pinch-to-zoom (2 fingers) + single-finger
|
// Touch event handlers: pinch-to-zoom (2 fingers) + single-finger
|
||||||
// carousel-style swipe nav. Swipe is suppressed while zoomed in so the
|
// carousel-style swipe nav. Swipe is suppressed while zoomed in so the
|
||||||
// user can pan instead. The carousel is also disabled mid-animation.
|
// user can pan instead. The carousel is also disabled mid-animation.
|
||||||
@@ -860,7 +853,6 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
key={slideKey(photo, slot)}
|
key={slideKey(photo, slot)}
|
||||||
className="h-full flex items-center justify-center"
|
className="h-full flex items-center justify-center"
|
||||||
style={{ flex: '0 0 33.3333%' }}
|
style={{ flex: '0 0 33.3333%' }}
|
||||||
onClick={handleImageClick}
|
|
||||||
>
|
>
|
||||||
<AuthenticatedImage
|
<AuthenticatedImage
|
||||||
// Same preview-prefer-with-fallback logic as the
|
// Same preview-prefer-with-fallback logic as the
|
||||||
@@ -915,7 +907,6 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
<div
|
<div
|
||||||
ref={trackContainerRef}
|
ref={trackContainerRef}
|
||||||
className="absolute top-0 left-0 bottom-0 overflow-hidden z-0"
|
className="absolute top-0 left-0 bottom-0 overflow-hidden z-0"
|
||||||
onClick={isVideoCurrent ? undefined : handleImageClick}
|
|
||||||
onMouseDown={isVideoCurrent ? undefined : handleMouseDown}
|
onMouseDown={isVideoCurrent ? undefined : handleMouseDown}
|
||||||
onMouseMove={isVideoCurrent ? undefined : handleMouseMove}
|
onMouseMove={isVideoCurrent ? undefined : handleMouseMove}
|
||||||
onMouseUp={isVideoCurrent ? undefined : handleMouseUp}
|
onMouseUp={isVideoCurrent ? undefined : handleMouseUp}
|
||||||
|
|||||||
Reference in New Issue
Block a user