@wentools/overlay 0.1.2 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/popover.svelte +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wentools/overlay",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Svelte 5 popover, dropdown menu, and tooltip components with CSS custom property theming",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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 (