shelving 1.295.1 → 1.295.2
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/ui/dialog/Dialog.js +5 -4
- package/ui/dialog/Dialog.tsx +5 -3
package/package.json
CHANGED
package/ui/dialog/Dialog.js
CHANGED
|
@@ -40,11 +40,12 @@ function _closeOnBackdropClick({ currentTarget, target }) {
|
|
|
40
40
|
if (target instanceof Element && target.closest("a:any-link, nav button:enabled"))
|
|
41
41
|
_requestClose(currentTarget);
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Ask a `<dialog>` to close: fire a cancelable `cancel` event, so `<Dialog>` can run `onClose` in a transition. Close it at once only when nothing cancels the event.
|
|
45
|
+
* - Not `requestClose()`: some browsers lack it, and Safari fires its `cancel` event as not cancelable. Both close the dialog at once, so it vanishes with no fade.
|
|
46
|
+
*/
|
|
44
47
|
function _requestClose(dialog) {
|
|
45
|
-
if (
|
|
46
|
-
dialog.requestClose();
|
|
47
|
-
else
|
|
48
|
+
if (dialog.dispatchEvent(new Event("cancel", { cancelable: true })))
|
|
48
49
|
dialog.close();
|
|
49
50
|
}
|
|
50
51
|
/**
|
package/ui/dialog/Dialog.tsx
CHANGED
|
@@ -74,10 +74,12 @@ function _closeOnBackdropClick({ currentTarget, target }: MouseEvent<HTMLDialogE
|
|
|
74
74
|
if (target instanceof Element && target.closest("a:any-link, nav button:enabled")) _requestClose(currentTarget);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Ask a `<dialog>` to close: fire a cancelable `cancel` event, so `<Dialog>` can run `onClose` in a transition. Close it at once only when nothing cancels the event.
|
|
79
|
+
* - Not `requestClose()`: some browsers lack it, and Safari fires its `cancel` event as not cancelable. Both close the dialog at once, so it vanishes with no fade.
|
|
80
|
+
*/
|
|
78
81
|
function _requestClose(dialog: HTMLDialogElement): void {
|
|
79
|
-
if (
|
|
80
|
-
else dialog.close();
|
|
82
|
+
if (dialog.dispatchEvent(new Event("cancel", { cancelable: true }))) dialog.close();
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/**
|