From 812961dcec13a5151e83a8d0248e91103b0142ac Mon Sep 17 00:00:00 2001 From: vcoppe Date: Wed, 12 Jun 2024 13:18:15 +0200 Subject: [PATCH] fix selection bug --- .../lib/components/file-list/FileListNodeContent.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/src/lib/components/file-list/FileListNodeContent.svelte b/website/src/lib/components/file-list/FileListNodeContent.svelte index f731ed63..5ee8de67 100644 --- a/website/src/lib/components/file-list/FileListNodeContent.svelte +++ b/website/src/lib/components/file-list/FileListNodeContent.svelte @@ -47,7 +47,7 @@ let sortable: Sortable; let orientation = getContext<'vertical' | 'horizontal'>('orientation'); - function updateToSelection() { + function updateToSelection(e) { if (updating) return; updating = true; // Sortable updates selection @@ -61,6 +61,13 @@ element.classList.contains('sortable-selected') ); }); + + if ($selection.size > 1 && !(e.ctrlKey || e.metaKey || e.shiftKey)) { + // Fix bug that sometimes causes a single select to be treated as a multi-select + $selection.clear(); + $selection.set(item.extend(getRealId(changed[0])), true); + } + return $selection; }); }