diff --git a/client/src/components/Journey/PhotoLightbox.test.tsx b/client/src/components/Journey/PhotoLightbox.test.tsx index 1675afa97..a505c9eb9 100644 --- a/client/src/components/Journey/PhotoLightbox.test.tsx +++ b/client/src/components/Journey/PhotoLightbox.test.tsx @@ -1,4 +1,4 @@ -// FE-COMP-LIGHTBOX-001 to FE-COMP-LIGHTBOX-029 +// FE-COMP-LIGHTBOX-001 to FE-COMP-LIGHTBOX-030 // Plyr needs a real media pipeline, so the player is stubbed here. vi.mock('./VideoPlayer', () => ({ @@ -305,6 +305,13 @@ describe('PhotoLightbox', () => { fireEvent.touchEnd(surface, { changedTouches: [{ clientX: 100, clientY: 210 }] }); expect(screen.getByText('2 / 3')).toBeInTheDocument(); }); + + it('FE-COMP-LIGHTBOX-030: the left inset of the screen stays on the left, where the close button now sits', () => { + render(); + const style = screen.getByRole('dialog').style; + expect(style.paddingInlineEnd).toContain('safe-area-inset-left'); + expect(style.paddingInlineStart).toContain('safe-area-inset-right'); + }); }); it('FE-COMP-LIGHTBOX-027: a caption with a source page links to it in a new tab, one without stays text', () => { diff --git a/client/src/components/Journey/PhotoLightbox.tsx b/client/src/components/Journey/PhotoLightbox.tsx index 3fc05269d..383c76990 100644 --- a/client/src/components/Journey/PhotoLightbox.tsx +++ b/client/src/components/Journey/PhotoLightbox.tsx @@ -144,8 +144,9 @@ export default function PhotoLightbox({ photos, startIndex = 0, onClose, label } background: 'rgba(0,0,0,0.92)', backdropFilter: 'blur(20px)', display: 'flex', flexDirection: 'column', paddingBottom: SAFE('bottom'), - paddingInlineStart: SAFE('left'), - paddingInlineEnd: SAFE('right'), + // The insets belong to the screen's sides, which right to left swaps. + paddingInlineStart: SAFE(rtl ? 'right' : 'left'), + paddingInlineEnd: SAFE(rtl ? 'left' : 'right'), }} onTouchStart={onTouchStart} onTouchMove={onTouchMove} diff --git a/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx b/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx index c8b501017..a45ad7251 100644 --- a/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx +++ b/client/src/mobile/screens/trip/tabs/MFileLightbox.tsx @@ -52,10 +52,11 @@ export default function MFileLightbox({ files, index, onIndexChange, onClose, t > {/* Header */} {/* Below the status bar and a notch, and clear of a side inset in landscape, - so the close button is always there to tap. */} + so the close button is always there to tap. The insets are the screen's + sides, so right to left takes them the other way round. */}
e.stopPropagation()} > diff --git a/client/tests/unit/mobile/trip/MFileLightbox.test.tsx b/client/tests/unit/mobile/trip/MFileLightbox.test.tsx index 654c0ba50..9aa76fa2a 100644 --- a/client/tests/unit/mobile/trip/MFileLightbox.test.tsx +++ b/client/tests/unit/mobile/trip/MFileLightbox.test.tsx @@ -5,7 +5,7 @@ import { downloadFile, openFile } from '../../../../src/utils/fileDownload' import type { TranslationFn, TripFile } from '../../../../src/types' import { fireEvent, render, screen, waitFor } from '../../../helpers/render' -// FE-MOB-FLBOX-001 to FE-MOB-FLBOX-017 +// FE-MOB-FLBOX-001 to FE-MOB-FLBOX-018 vi.mock('../../../../src/api/authUrl', () => ({ getAuthUrl: vi.fn(async (url: string) => `${url}?token=t1`), @@ -230,4 +230,11 @@ describe('MFileLightbox', () => { expect(screen.getByAltText('castle.png')).toHaveAttribute('src', '/api/trips/1/files/2/download?token=t1'), ) }) + + it('FE-MOB-FLBOX-018: right to left, the header keeps each side inset on its own screen side', () => { + renderBox(0) + const header = screen.getByText('beach.jpg').closest('[role="presentation"]') as HTMLElement + expect(header.className).toContain('rtl:ps-[calc(var(--m-safe-r)+16px)]') + expect(header.className).toContain('rtl:pe-[calc(var(--m-safe-l)+12px)]') + }) })