Skip to content

Commit 82ecbb5

Browse files
committed
Add portal for z-index issue
1 parent 50578aa commit 82ecbb5

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

src/components/Simulator/NotificationPopover.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
PopoverHeader,
99
PopoverCloseButton,
1010
Flex,
11+
Portal,
1112
} from "@chakra-ui/react"
1213
import React, { type ReactNode } from "react"
1314

@@ -26,24 +27,26 @@ export const NotificationPopover: React.FC<IProps> = ({
2627
return (
2728
<Popover placement={placement}>
2829
<PopoverTrigger>{children}</PopoverTrigger>
29-
<PopoverContent
30-
bg="background.highlight"
31-
px={4}
32-
py={2}
33-
maxW="15rem"
34-
borderRadius="base"
35-
boxShadow="tooltip"
36-
fontSize="xs"
37-
{...restProps}
38-
>
39-
<Flex gap={2} zIndex={100000000}>
40-
<PopoverHeader fontWeight="bold" mb={2} flex={1} mt={0.5}>
41-
{title || ""}
42-
</PopoverHeader>
43-
<PopoverCloseButton ms="auto" />
44-
</Flex>
45-
<PopoverBody>{content}</PopoverBody>
46-
</PopoverContent>
30+
<Portal>
31+
<PopoverContent
32+
bg="background.highlight"
33+
px={4}
34+
py={2}
35+
maxW="15rem"
36+
borderRadius="base"
37+
boxShadow="tooltip"
38+
fontSize="xs"
39+
{...restProps}
40+
>
41+
<Flex gap={2} zIndex={100000000}>
42+
<PopoverHeader fontWeight="bold" mb={2} flex={1} mt={0.5}>
43+
{title || ""}
44+
</PopoverHeader>
45+
<PopoverCloseButton ms="auto" />
46+
</Flex>
47+
<PopoverBody>{content}</PopoverBody>
48+
</PopoverContent>
49+
</Portal>
4750
</Popover>
4851
)
4952
}

0 commit comments

Comments
 (0)