From 54e042b736372bd9dc331c44eb1bd627c807cba8 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 20 Apr 2026 16:43:21 +0200 Subject: [PATCH] fix(journey): repair gallery picker grid collapsing in Safari (#717) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'From Gallery' picker on the journey entry editor used `aspect-square` on grid items inside an overflow-scrolling container. Safari (desktop and iOS) collapses the computed height of aspect-ratio boxes in this layout, which stacked every thumbnail at y=0 — making selection impossible. Swap to the classic padding-top spacer pattern (`paddingTop: '100%'` on the cell + absolutely positioned image) which is bulletproof across browsers and preserves the 5/6-column grid on mobile/desktop. --- client/src/pages/JourneyDetailPage.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/pages/JourneyDetailPage.tsx b/client/src/pages/JourneyDetailPage.tsx index 59e8598d..ba69cd79 100644 --- a/client/src/pages/JourneyDetailPage.tsx +++ b/client/src/pages/JourneyDetailPage.tsx @@ -2312,7 +2312,10 @@ function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, onClose, onSa )} - {/* Gallery picker — directly below buttons */} + {/* Gallery picker — directly below buttons. Safari collapses + `aspect-square` items inside an overflow-scroll grid, so + the square is enforced with a padding-top spacer + an + absolutely positioned image (works across all browsers). */} {showGalleryPick && (
@@ -2330,9 +2333,10 @@ function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, onClose, onSa setPhotos(prev => [...prev, gp]) } }} - className="aspect-square rounded-lg overflow-hidden cursor-pointer hover:ring-2 hover:ring-zinc-900 dark:hover:ring-white hover:ring-offset-1 dark:hover:ring-offset-zinc-900 transition-all" + className="relative w-full rounded-lg overflow-hidden cursor-pointer hover:ring-2 hover:ring-zinc-900 dark:hover:ring-white hover:ring-offset-1 dark:hover:ring-offset-zinc-900 transition-all" + style={{ paddingTop: '100%' }} > - { const img = e.currentTarget; const orig = photoUrl(gp, 'original'); if (!img.src.includes('/original')) img.src = orig }} /> + { const img = e.currentTarget; const orig = photoUrl(gp, 'original'); if (!img.src.includes('/original')) img.src = orig }} />
))} {galleryPhotos.filter(gp => !photos.some(p => p.id === gp.id)).length === 0 && (