nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[Feature Request] Make zIndex as a prop for modal and popover

Open mattp0123 opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

In this codesandbox example, the popover will always on top of the modal, because of the root of popover has a z-index: 100000 inline style.

Describe the solution you'd like

Make zIndex as a prop for modal and popover and don't set any zIndex as default, let us choose what zIndex should be given to the modal/popover like Radix does.

Describe alternatives you've considered

No other thoughts

Screenshots or Videos

No response

mattp0123 avatar Aug 13 '22 05:08 mattp0123

I notice that modals always have zIndex: $max value (9999).

This setting produce problems when you want to render any component on top of modal. For example custom select with menu. Menu should be on top of modal with scrolling. Even if you use portals menus can't be higher than modal too.

notmedia avatar Aug 13 '22 10:08 notmedia

You can give the Popover content a different z-index using <Popover.Content css={{ zIndex: "unset !important" }}>. The !important is required, because the Popover content container has the z-index set using element.style.

https://codesandbox.io/s/next-ui-modal-z-index-forked-dmib1x?file=/src/app.tsx

Alternatively, maybe close the Popover when you open the modal? Interacting with the modal itself closes the Popover anyway.

TechnologicNick avatar Aug 14 '22 22:08 TechnologicNick

Hey guys please update to v2 https://nextui.org/blog/nextui-v2

jrgarciadev avatar Aug 02 '23 02:08 jrgarciadev