diff --git a/ui/src/Pages/SharePage/AlbumSharePage.tsx b/ui/src/Pages/SharePage/AlbumSharePage.tsx index 8d132f8..02427d1 100644 --- a/ui/src/Pages/SharePage/AlbumSharePage.tsx +++ b/ui/src/Pages/SharePage/AlbumSharePage.tsx @@ -141,9 +141,18 @@ const AlbumSharePage = ({ albumID, token, password }: AlbumSharePageProps) => { const album = data?.album // Open the detail sidebar with the first (newest) photo when the page loads. + // On small screens the sidebar is a full-screen drawer, so leave it closed. useEffect(() => { if (!album || openedAlbumID.current === album.id) return + if ( + typeof window === 'undefined' || + typeof window.matchMedia !== 'function' || + !window.matchMedia('(min-width: 1024px)').matches + ) { + return + } + const firstMedia = album.media[0] if (!firstMedia) return