From 65ac8f76d2fb9885eb5723a1858f191df3884c3c Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Mon, 20 Jul 2026 00:38:34 +0200 Subject: [PATCH] refactor(ui): ctrl + A or command + A to select all items --- .../src/lib/components/ResourceList.svelte | 72 +++++++++++++++---- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/frontend/src/lib/components/ResourceList.svelte b/frontend/src/lib/components/ResourceList.svelte index 496bf8a2..62007e6a 100644 --- a/frontend/src/lib/components/ResourceList.svelte +++ b/frontend/src/lib/components/ResourceList.svelte @@ -540,6 +540,25 @@ onselectionchange?.(selected); } } + + // Ctrl+A (Linux / Windows) / ⌘+A (macOS) selects every visible row. + // Handled here rather than in each page's own `svelte:window` so all + // consumers get the shortcut for free — /files, /trash, /favorites, + // /recent, /shared-with-me — with identical semantics. Only fires + // when `selectable` is on, and only when the focused element isn't + // a text input (typing inside a search box shouldn't hijack it). + function onSelectAllShortcut(e: KeyboardEvent) { + if (!selectable) return; + if (!(e.ctrlKey || e.metaKey)) return; + if (e.key.toLowerCase() !== 'a') return; + const tag = (e.target as HTMLElement | null)?.tagName; + if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return; + // Also skip when the focus is inside a contentEditable region + // (rich-text popups, name inline-edit if ever added). + if ((e.target as HTMLElement | null)?.isContentEditable) return; + e.preventDefault(); + toggleSelectAll(); + } // `selectedItems` and the reap-stale effect below stay on the RAW // items — selection persists across a display-filter toggle, and // stale-selection cleanup only fires when items truly leave the @@ -779,9 +798,16 @@ }} /> {/if} + + {#if rowBadge} + {@render rowBadge(item, ctx)} + {/if} {item.name} - {#if rowBadge}{@render rowBadge(item, ctx)}{/if} {#if showOwner}
@@ -803,8 +829,14 @@
{/if}
- {#if showDate && dateCell}{@render dateCell(item, ctx)}{/if} + {#if sizeVal != null}{formatBytes(sizeVal)}{/if} {#if dateVal != null}{formatDate(dateVal)}{/if} @@ -861,6 +893,11 @@
{/snippet} + + +