Skip to content

Commit 89292fe

Browse files
authored
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.
1 parent 1193a23 commit 89292fe

File tree

1 file changed

+3
-1
lines changed
  • web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]

1 file changed

+3
-1
lines changed

web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
5353
let { isViewing: showAssetViewer } = assetViewingStore;
5454
const viewport: Viewport = $state({ width: 0, height: 0 });
55+
let searchResultsElement: HTMLElement | undefined = $state();
5556
5657
// The GalleryViewer pushes it's own history state, which causes weird
5758
// behavior for history.back(). To prevent that we store the previous page
@@ -362,6 +363,7 @@
362363
class="mb-12 bg-immich-bg dark:bg-immich-dark-bg m-4"
363364
bind:clientHeight={viewport.height}
364365
bind:clientWidth={viewport.width}
366+
bind:this={searchResultsElement}
365367
>
366368
{#if searchResultAlbums.length > 0}
367369
<section>
@@ -381,8 +383,8 @@
381383
onIntersected={loadNextPage}
382384
showArchiveIcon={true}
383385
{viewport}
384-
pageHeaderOffset={54}
385386
onReload={onSearchQueryUpdate}
387+
slidingWindowOffset={searchResultsElement.offsetTop}
386388
/>
387389
{:else if !isLoading}
388390
<div class="flex min-h-[calc(66vh-11rem)] w-full place-content-center items-center dark:text-white">

0 commit comments

Comments
 (0)