@r2digisolutions/components 0.14.19 → 0.14.20

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.
@@ -76,6 +76,8 @@
76
76
  }: DialogProps = $props();
77
77
 
78
78
  let dialogEl = $state<HTMLDialogElement | null>(null);
79
+ /** Ignora clics en backdrop justo tras cerrar un diálogo nativo (p. ej. selector de archivos). */
80
+ let suppressBackdropUntil = 0;
79
81
  const titleId = $derived(`${id}-title`);
80
82
  const descriptionId = $derived(`${id}-description`);
81
83
 
@@ -152,6 +154,15 @@
152
154
  };
153
155
  });
154
156
 
157
+ $effect(() => {
158
+ if (!open || typeof window === 'undefined') return;
159
+ const onWindowFocus = () => {
160
+ suppressBackdropUntil = Date.now() + 400;
161
+ };
162
+ window.addEventListener('focus', onWindowFocus);
163
+ return () => window.removeEventListener('focus', onWindowFocus);
164
+ });
165
+
155
166
  function close(reason: 'close' | 'cancel' | 'confirm' | 'backdrop' | 'escape' = 'close') {
156
167
  if (!open) return;
157
168
  open = false;
@@ -186,6 +197,7 @@
186
197
 
187
198
  function handleBackdropClick(event: MouseEvent) {
188
199
  if (!dialogEl) return;
200
+ if (Date.now() < suppressBackdropUntil) return;
189
201
  const rect = dialogEl.getBoundingClientRect();
190
202
  const clickedInDialog =
191
203
  event.clientX >= rect.left &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.14.19",
3
+ "version": "0.14.20",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",