From 814679451112b555f82a585f7b2689e62dfb955c Mon Sep 17 00:00:00 2001 From: Shinichi Okada <147320+shinokada@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:55:35 +0200 Subject: [PATCH] v0.46.17 --- src/lib/utils/Popper.svelte | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/utils/Popper.svelte b/src/lib/utils/Popper.svelte index 1cd19a682..81a8ec26c 100644 --- a/src/lib/utils/Popper.svelte +++ b/src/lib/utils/Popper.svelte @@ -73,7 +73,7 @@ // This ensures that the floating element does not hide immediately when the mouse // moves from the reference element to the floating element. setTimeout(() => { - if (ev.type === 'mouseleave' && !elements.some(hasHover)) { + if ((ev.type === 'mouseleave' || ev.type === 'pointerleave') && !elements.some(hasHover)) { open = false; } }, 100); @@ -128,8 +128,8 @@ ['focusin', showHandler, focusable], ['focusout', hideHandler, focusable], ['click', showHandler, clickable], - ['mouseenter', showHandler, hoverable], - ['mouseleave', hideHandler, hoverable] + ['pointerenter', showHandler, hoverable], + ['pointerleave', hideHandler, hoverable] ]; if (triggeredBy) triggerEls = [...document.querySelectorAll(triggeredBy)]; @@ -150,7 +150,7 @@ console.error(`Popup reference not found: '${reference}'`); } else { if (focusable) referenceEl.addEventListener('focusout', hideHandler); - if (hoverable) referenceEl.addEventListener('mouseleave', hideHandler); + if (hoverable) referenceEl.addEventListener('pointerleave', hideHandler); } } else { referenceEl = triggerEls[0]; @@ -168,7 +168,7 @@ if (referenceEl) { referenceEl.removeEventListener('focusout', hideHandler); - referenceEl.removeEventListener('mouseleave', hideHandler); + referenceEl.removeEventListener('pointerleave', hideHandler); } document.removeEventListener('click', closeOnClickOutside);