Skip to content

Commit 72d2c2f

Browse files
committed
fix a bug where when you open a modal from a popover, the popover is not blurred
1 parent 72d12b4 commit 72d2c2f

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

code/core/src/components/components/Modal/Modal.styled.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const Overlay = styled.div<{
8383
inset: 0,
8484
width: '100%',
8585
height: '100%',
86-
zIndex: 90,
86+
zIndex: 100000,
8787
'@media (prefers-reduced-motion: no-preference)': {
8888
animation:
8989
$status === 'exiting' || $status === 'preExit'
@@ -106,7 +106,7 @@ export const Container = styled.div<{
106106
boxShadow: '0px 4px 67px 0px #00000040',
107107
position: 'absolute',
108108
overflow: 'auto',
109-
zIndex: 100,
109+
zIndex: 100000,
110110

111111
'&:focus-visible': {
112112
outline: 'none',

code/core/src/components/components/Popover/Popover.stories.tsx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22

3-
import { Button } from 'storybook/internal/components';
3+
import { Button, Modal, PopoverProvider } from 'storybook/internal/components';
44

55
import { CloseAltIcon } from '@storybook/icons';
66

7+
import { screen } from 'storybook/test';
78
import { fn } from 'storybook/test';
89

910
import preview from '../../../../../.storybook/preview';
@@ -146,3 +147,34 @@ export const WithoutColor = meta.story({
146147
color: 'none',
147148
},
148149
});
150+
151+
const PopoverWithModal = () => {
152+
const [isOpen, setIsOpen] = useState(false);
153+
return (
154+
<div>
155+
<Button ariaLabel={false} onClick={() => setIsOpen(true)}>
156+
Open modal
157+
</Button>
158+
<Modal open={isOpen} onOpenChange={setIsOpen}>
159+
<div>Hello</div>
160+
</Modal>
161+
</div>
162+
);
163+
};
164+
165+
export const WithModal = meta.story({
166+
render: () => {
167+
const [isPopoverOpen, setIsPopoverOpen] = useState(true);
168+
return (
169+
<>
170+
<PopoverProvider visible={isPopoverOpen} popover={<PopoverWithModal />}>
171+
<Button ariaLabel={false}>Open popover</Button>
172+
</PopoverProvider>
173+
<div style={{ width: 100, height: 100, backgroundColor: 'thistle' }}></div>
174+
</>
175+
);
176+
},
177+
play: async ({ userEvent }) => {
178+
await userEvent.click(screen.getByRole('button', { name: 'Open modal' }));
179+
},
180+
});

0 commit comments

Comments
 (0)