@14ch/svelte-ui 0.0.63 → 0.0.64

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.
@@ -103,18 +103,20 @@
103
103
  });
104
104
 
105
105
  $effect(() => {
106
- if (!isOpen || !dialogRef) return;
106
+ if (!dialogRef) return;
107
107
 
108
- const handleKeyDown = (event: KeyboardEvent) => {
109
- if (event.key === 'Escape') {
110
- close();
111
- }
108
+ // showModal() した dialog は最前面の1つだけに cancel が配送されるため、
109
+ // Escape で多重の Modal がまとめて閉じることを防げる。ネイティブの即時
110
+ // クローズは抑止し、fade-out アニメーション付きの close() を使う。
111
+ const handleCancel = (event: Event) => {
112
+ event.preventDefault();
113
+ close();
112
114
  };
113
115
 
114
- document.addEventListener('keydown', handleKeyDown);
116
+ dialogRef.addEventListener('cancel', handleCancel);
115
117
 
116
118
  return () => {
117
- document.removeEventListener('keydown', handleKeyDown);
119
+ dialogRef.removeEventListener('cancel', handleCancel);
118
120
  };
119
121
  });
120
122
 
@@ -553,7 +553,7 @@
553
553
  id={popupId}
554
554
  data-testid="popup"
555
555
  use:clickOutside={() => {
556
- close('outside');
556
+ if (isOpen) close('outside');
557
557
  }}
558
558
  >
559
559
  {@render children()}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@14ch/svelte-ui",
3
3
  "description": "Modern Svelte UI components library with TypeScript support",
4
4
  "private": false,
5
- "version": "0.0.63",
5
+ "version": "0.0.64",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "svelte",