From 89292fecb4d1319658486d1065f3dd6084f45dda Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Wed, 6 Aug 2025 22:34:24 +0100 Subject: [PATCH] fix(web): use correct sliding window offset for search results (#20726) The contents of search results are slightly offset by the search bar, search terms and spacing (margins/padding), and needs to be factored in when calculating whether an asset is visible or not. The offset was 0, which meant that assets were removed from view too early. --- .../search/[[photos=photos]]/[[assetId=id]]/+page.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte index e7798b1ac7..b3177fc39e 100644 --- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -52,6 +52,7 @@ let { isViewing: showAssetViewer } = assetViewingStore; const viewport: Viewport = $state({ width: 0, height: 0 }); + let searchResultsElement: HTMLElement | undefined = $state(); // The GalleryViewer pushes it's own history state, which causes weird // behavior for history.back(). To prevent that we store the previous page @@ -362,6 +363,7 @@ class="mb-12 bg-immich-bg dark:bg-immich-dark-bg m-4" bind:clientHeight={viewport.height} bind:clientWidth={viewport.width} + bind:this={searchResultsElement} > {#if searchResultAlbums.length > 0}
@@ -381,8 +383,8 @@ onIntersected={loadNextPage} showArchiveIcon={true} {viewport} - pageHeaderOffset={54} onReload={onSearchQueryUpdate} + slidingWindowOffset={searchResultsElement.offsetTop} /> {:else if !isLoading}