@yuanhhou/ds 0.6.0 → 0.6.1
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/lib/index.js +1 -1
- package/lib/types/Modal/Modal.d.ts +2 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -193,7 +193,7 @@ function _({ open: n, onClose: s, title: c, description: l, children: u, actions
|
|
|
193
193
|
let v = i();
|
|
194
194
|
r(() => {
|
|
195
195
|
let e = g.current;
|
|
196
|
-
e && (n && !e.open ? e.showModal() : !n && e.open && e.close());
|
|
196
|
+
e && (n && !e.open ? (e.showModal(), e.querySelector("[data-autofocus]")?.focus()) : !n && e.open && e.close());
|
|
197
197
|
}, [n]), r(() => {
|
|
198
198
|
let e = g.current;
|
|
199
199
|
if (!e) return;
|
|
@@ -28,7 +28,8 @@ export interface ModalProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* A modal dialog built on the native `<dialog>` element and `showModal()`, so the browser provides the
|
|
30
30
|
* focus trap, the inert page behind it, Escape and the top layer. Focus moves to the first focusable
|
|
31
|
-
* element inside
|
|
31
|
+
* element inside, or to the one marked `data-autofocus` (for example the field in a password modal),
|
|
32
|
+
* and returns to the opener when it closes.
|
|
32
33
|
* iOS has no DS modal: use the native `.sheet` (see docs/ios.md).
|
|
33
34
|
*/
|
|
34
35
|
export declare function Modal({ open, onClose, title, description, children, actions, closeLabel, dismissOnBackdrop, className, }: ModalProps): import("react").JSX.Element;
|