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; }