diff --git a/.changeset/hot-wombats-push.md b/.changeset/hot-wombats-push.md new file mode 100644 index 000000000..f90291d8c --- /dev/null +++ b/.changeset/hot-wombats-push.md @@ -0,0 +1,5 @@ +--- +'@sovryn/ui': patch +--- + +chore: custom dialog zIndex diff --git a/packages/ui/src/2_molecules/Dialog/Dialog.tsx b/packages/ui/src/2_molecules/Dialog/Dialog.tsx index 65e7ae05e..41ac5a33a 100644 --- a/packages/ui/src/2_molecules/Dialog/Dialog.tsx +++ b/packages/ui/src/2_molecules/Dialog/Dialog.tsx @@ -33,6 +33,7 @@ type DialogProps = { initialFocusRef?: React.RefObject; disableFocusTrap?: boolean; buttonCloseText?: string; + initialZIndex?: number; }; export const Dialog: IDialogFunctionComponent = ({ @@ -47,6 +48,7 @@ export const Dialog: IDialogFunctionComponent = ({ initialFocusRef, disableFocusTrap, buttonCloseText, + initialZIndex = 100, }) => { const ref = useRef(null); @@ -61,9 +63,9 @@ export const Dialog: IDialogFunctionComponent = ({ // make sure that multiple dialogs opened showing up in correct order. if (isOpen) { Dialog.index++; - setZIndex(100 + Dialog.index); + setZIndex(initialZIndex + Dialog.index); } - }, [isOpen]); + }, [isOpen, initialZIndex]); useEffect(() => { const handleEscape = (event: KeyboardEvent) => {