From ed3caa5619b8a577d0fc2fe2b6bdae90fc47ac69 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 13 Oct 2026 00:09:58 +0400 Subject: [PATCH] refac --- .../layout/Sidebar/RecursiveFolder.svelte | 91 ++++++++++--------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte index 6e4007f263..867c1b2c8e 100644 --- a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte +++ b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte @@ -596,10 +596,6 @@ setFolderItems(); } - const shouldIgnoreRowClick = (target) => { - return target instanceof Element && !!target.closest('button, a, input, [role="menu"]'); - }; - const openFolderHandler = async () => { const folder = await getFolderById(localStorage.token, folderId).catch((error) => { toast.error(`${error}`); @@ -744,42 +740,14 @@ >
+
{ - if (!isWritable) return; - if (clickTimer) { - clearTimeout(clickTimer); // cancel the single-click action - clickTimer = null; - } - renameHandler(); - }} - role="button" - tabindex="0" - on:click={async (e) => { - e.stopPropagation(); - if (shouldIgnoreRowClick(e.target)) return; - if (clickTimer) { - clearTimeout(clickTimer); - clickTimer = null; - } - - clickTimer = setTimeout(async () => { - await openFolderHandler(); - clickTimer = null; - }, 100); // 100ms delay (typical double-click threshold) - }} - on:keydown={(e) => { - if (e.currentTarget !== e.target) return; - if (e.key === 'Enter' || e.key === ' ') { - e.preventDefault(); - openFolderHandler(); - } - }} + on:click|stopPropagation >