From f4ba51491cd4d434b55bfd7610a8ba72fd802ea7 Mon Sep 17 00:00:00 2001 From: BearToCode Date: Fri, 18 Oct 2024 12:38:17 +0200 Subject: [PATCH] fix(#125): slash buttons not clickable fix: #125 --- packages/plugin-slash/src/lib/Slash.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/plugin-slash/src/lib/Slash.svelte b/packages/plugin-slash/src/lib/Slash.svelte index 7873941d..70fb3e16 100644 --- a/packages/plugin-slash/src/lib/Slash.svelte +++ b/packages/plugin-slash/src/lib/Slash.svelte @@ -21,16 +21,20 @@ carta.input?.textarea.addEventListener('keydown', handleKeyDown); carta.input?.textarea.addEventListener('keyup', handleKeyUp); carta.input?.textarea.addEventListener('click', hide); - carta.input?.textarea.addEventListener('blur', hide); + carta.input?.textarea.addEventListener('blur', hideWithDelay); }); onDestroy(() => { carta.input?.textarea.removeEventListener('keydown', handleKeyDown); carta.input?.textarea.removeEventListener('keyup', handleKeyUp); carta.input?.textarea.removeEventListener('click', hide); - carta.input?.textarea.removeEventListener('blur', hide); + carta.input?.textarea.removeEventListener('blur', hideWithDelay); }); + function hideWithDelay() { + setTimeout(hide, 100); + } + function hide() { visible = false; }