Skip to content

Commit

Permalink
v0.46.17
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada authored and mrh1997 committed Sep 26, 2024
1 parent 099cfa6 commit 8146794
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/utils/Popper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<HTMLElement>(triggeredBy)];
Expand All @@ -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];
Expand All @@ -168,7 +168,7 @@
if (referenceEl) {
referenceEl.removeEventListener('focusout', hideHandler);
referenceEl.removeEventListener('mouseleave', hideHandler);
referenceEl.removeEventListener('pointerleave', hideHandler);
}
document.removeEventListener('click', closeOnClickOutside);
Expand Down

0 comments on commit 8146794

Please sign in to comment.