mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
fix(mobile): keep the photo viewers clear of a side notch in right to left languages
The screen insets stay on their own physical sides when the text runs right to left, so the close button no longer sits under the camera in landscape.
This commit is contained in:
@@ -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(<PhotoLightbox photos={samplePhotos} onClose={vi.fn()} />);
|
||||
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', () => {
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user