Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/core] Modal: Make body's zIndex same as overlay's. #4587

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/mantine-core/src/Modal/Modal.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,24 @@ export function NativeScrollArea() {
</div>
);
}

export function NestedModals() {
const [parentOpened, { open: parentOpen, close: parentClose }] = useDisclosure(false);
const [nestedOpened, { open: nestedOpen, close: nestedClose }] = useDisclosure(false);

return (
<div style={{ padding: 40 }}>
<Modal opened={parentOpened} onClose={parentClose} title="Parent Modal" size={1400} centered>
<div>{content}</div>

<Button onClick={nestedOpen}>Open Nested</Button>

<Modal opened={nestedOpened} onClose={nestedClose} title="Nested Modal" centered>
<div>Nested Content</div>
</Modal>
</Modal>

<Button onClick={parentOpen}>Open Parent</Button>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ModalBaseContent = forwardRef<HTMLElement, ModalBaseContentProps>((
props
);

const { classes, cx } = useStyles({ zIndex: ctx.zIndex + 1 }, ctx.stylesApi);
const { classes, cx } = useStyles({ zIndex: ctx.zIndex }, ctx.stylesApi);

const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
const shouldTrigger =
Expand Down