From 7dd1ad2e557888b4e58513c713162ae8101130bb Mon Sep 17 00:00:00 2001 From: Brandon Oxendine Date: Tue, 20 Oct 2026 12:46:52 +0200 Subject: [PATCH] Keep list search usable in narrow windows The patch and issue list topbars decided whether to show filter labels from the viewport width, which ignores the sidebar. With the search input open, the filters left it almost no room, and in narrower windows the actions were pushed past the window edge. Make the topbar a size container and show filter labels based on its own width. While searching, collapse inactive filters to icons and give the input a fixed width. When there is still not enough room, the filters scroll and fade out at the clipped edge. Fixes: 0d6def46000a2806784f4b707ad8b5197815b08b --- desktop/src/components/Topbar.svelte | 1 + desktop/src/lib/overflowFade.ts | 29 ++++++++ desktop/src/views/repo/Issues.svelte | 95 ++++++++++++++++++--------- desktop/src/views/repo/Patches.svelte | 87 +++++++++++++++--------- 4 files changed, 150 insertions(+), 62 deletions(-) create mode 100644 desktop/src/lib/overflowFade.ts diff --git a/desktop/src/components/Topbar.svelte b/desktop/src/components/Topbar.svelte index ca7a31c53..6b1ba4b35 100644 --- a/desktop/src/components/Topbar.svelte +++ b/desktop/src/components/Topbar.svelte @@ -19,6 +19,7 @@ border-bottom: 1px solid var(--color-border-subtle); font: var(--txt-body-m-regular); color: var(--color-text-secondary); + container-type: inline-size; } diff --git a/desktop/src/lib/overflowFade.ts b/desktop/src/lib/overflowFade.ts new file mode 100644 index 000000000..4e6844074 --- /dev/null +++ b/desktop/src/lib/overflowFade.ts @@ -0,0 +1,29 @@ +const fadeWidth = "3rem"; + +export function overflowFade(node: HTMLElement) { + function update() { + const start = node.scrollLeft > 0; + const end = node.scrollLeft + node.clientWidth < node.scrollWidth - 1; + const mask = + start || end + ? `linear-gradient(to right, ${start ? "transparent" : "black"} 0, black ${start ? fadeWidth : "0"}, black calc(100% - ${end ? fadeWidth : "0px"}), ${end ? "transparent" : "black"} 100%)` + : ""; + node.style.maskImage = mask; + node.style.webkitMaskImage = mask; + } + + const observer = new ResizeObserver(update); + observer.observe(node); + for (const child of node.children) { + observer.observe(child); + } + node.addEventListener("scroll", update, { passive: true }); + update(); + + return { + destroy() { + observer.disconnect(); + node.removeEventListener("scroll", update); + }, + }; +} diff --git a/desktop/src/views/repo/Issues.svelte b/desktop/src/views/repo/Issues.svelte index 81c42aef2..e00ae6c43 100644 --- a/desktop/src/views/repo/Issues.svelte +++ b/desktop/src/views/repo/Issues.svelte @@ -17,6 +17,7 @@ updateIssueCounts, } from "@app/lib/issueCounts.svelte"; import { show } from "@app/lib/modal"; + import { overflowFade } from "@app/lib/overflowFade"; import { createPaginatedList } from "@app/lib/paginatedList.svelte"; import * as router from "@app/lib/router"; import { modifierKey } from "@app/lib/utils"; @@ -135,6 +136,9 @@ display: flex; align-items: center; gap: 0.25rem; + min-width: 0; + overflow-x: auto; + scrollbar-width: none; } .filter { display: flex; @@ -158,6 +162,27 @@ .filter .global-counter-badge { margin-left: 0.25rem; } + .filters.compact .filter:not(.active) .filter-label { + display: none; + } + .actions { + display: flex; + align-items: center; + gap: 0.5rem; + margin-left: auto; + flex-shrink: 0; + } + .search { + display: flex; + } + .search.expanded { + width: 16rem; + } + @container (max-width: 40rem) { + .search.expanded { + width: 10rem; + } + } .row { border-bottom: 1px solid var(--color-border-subtle); } @@ -167,7 +192,7 @@
Issues -
+ -
- 0} - placeholder={`Search issues ${modifierKey()} + f`} - icon={loading ? "clock" : "search"} - onFocus={async () => { - try { - loading = true; - await list.loadMore(true); - } catch (e) { - console.error("Loading all issues failed: ", e); - } finally { - loading = false; - } - }} - onSubmit={async () => { - if (searchResults.length === 1) { - await router.push({ - resource: "repo.issue", - rid: repo.rid, - issue: searchResults[0].id, - status, - }); - } - }} - bind:show={showSearch} - bind:value={searchInput} /> +
+
diff --git a/desktop/src/views/repo/Patches.svelte b/desktop/src/views/repo/Patches.svelte index 8864e311f..7b9c5661a 100644 --- a/desktop/src/views/repo/Patches.svelte +++ b/desktop/src/views/repo/Patches.svelte @@ -11,6 +11,7 @@ import { searchCobs } from "@app/lib/cobSearch"; import { debounced } from "@app/lib/debounced.svelte"; import { channel, invoke } from "@app/lib/invoke"; + import { overflowFade } from "@app/lib/overflowFade"; import { createPaginatedList } from "@app/lib/paginatedList.svelte"; import { patchCountMismatch, @@ -126,6 +127,9 @@ display: flex; align-items: center; gap: 0.25rem; + min-width: 0; + overflow-x: auto; + scrollbar-width: none; } .filter { display: flex; @@ -155,11 +159,32 @@ .filter.active .filter-label { display: inline; } - @media (min-width: 1011px) { + @container (min-width: 54rem) { .filter-label { display: inline; } } + .filters.compact .filter:not(.active) .filter-label { + display: none; + } + .actions { + display: flex; + align-items: center; + gap: 0.5rem; + margin-left: auto; + flex-shrink: 0; + } + .search { + display: flex; + } + .search.expanded { + width: 16rem; + } + @container (max-width: 54rem) { + .search.expanded { + width: 10rem; + } + } .row { border-bottom: 1px solid var(--color-border-subtle); } @@ -169,7 +194,7 @@
Patches -
+ -
- 0} - placeholder={`Search patches ${modifierKey()} + f`} - icon={loading ? "clock" : "search"} - onFocus={async () => { - try { - loading = true; - await list.loadMore(true); - } catch (e) { - console.error("Loading all patches failed: ", e); - } finally { - loading = false; - } - }} - onSubmit={async () => { - if (searchResults.length === 1) { - await router.push({ - patch: searchResults[0].id, - resource: "repo.patch", - reviewId: undefined, - rid: repo.rid, - status, - }); - } - }} - bind:show={showSearch} - bind:value={searchInput} /> +
+