@wentools/overlay 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/popover.svelte +13 -1
package/package.json
CHANGED
package/src/popover.svelte
CHANGED
|
@@ -225,8 +225,19 @@ Perfect for: building custom popover patterns, tooltips, custom dropdowns.
|
|
|
225
225
|
actualPosition = newPosition
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
// Ignore click-outside for one frame after opening, so a programmatic open
|
|
229
|
+
// from pointerdown isn't immediately closed by the click from the same tap
|
|
230
|
+
let ignoreClickOutside = false
|
|
231
|
+
|
|
232
|
+
$effect(() => {
|
|
233
|
+
if (open) {
|
|
234
|
+
ignoreClickOutside = true
|
|
235
|
+
requestAnimationFrame(() => { ignoreClickOutside = false })
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
|
|
228
239
|
const handleClickOutside = (event: MouseEvent) => {
|
|
229
|
-
if (!open || !closeOnClickOutside) return
|
|
240
|
+
if (!open || !closeOnClickOutside || ignoreClickOutside) return
|
|
230
241
|
|
|
231
242
|
const target = event.target as Node
|
|
232
243
|
if (
|
|
@@ -313,5 +324,6 @@ Perfect for: building custom popover patterns, tooltips, custom dropdowns.
|
|
|
313
324
|
top: var(--popover-y);
|
|
314
325
|
left: var(--popover-x);
|
|
315
326
|
z-index: var(--popover-z-index, var(--layer-tooltip, 1000));
|
|
327
|
+
pointer-events: auto;
|
|
316
328
|
}
|
|
317
329
|
</style>
|