react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Ability to style the Popover overlay

Open deebov opened this issue 2 years ago โ€ข 5 comments

Provide a general summary of the feature here

Would be very useful to style the Popover overlay the same way as Modal and ModalOverlay.

๐Ÿค” Expected Behavior?

You should not be able to interact with outside elements while the popover is open.

๐Ÿ˜ฏ Current Behavior

If there are elements with zIndex set, you're able to click them while the popover is still open. That's due to the Popover Overlay not having any zIndex which makes it possible to click other elements with zIndex.

๐Ÿ’ Possible Solution

Either the popover overlay already comes with zIndex or an ability to customize the overlay.

๐Ÿ”ฆ Context

We have clickable elements with higher zIndex and if you try to close the popover by clicking outside, you can accidentally interact with an element with higher zIndex than the overlay.

๐Ÿ’ป Examples

No response

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

deebov avatar Oct 10 '23 13:10 deebov

Related to discussion in #5126. This would be nice to have, and since it's non-breaking it doesn't need to be added before RAC GA.

reidbarber avatar Oct 18 '23 23:10 reidbarber

hi @reidbarber , this is a niche blocker for us as well. we have an electron app we use the popovers in, and the overlays need this special style rule applied:

 -webkit-app-region: no-drag;

otherwise, window titlebars eat click events and prevent modals from being closed.

all we need is some way to target the underlay with styles, either by className, rendering a <Overlay /> element that replaces the built in one, or some other method as a workaround.

Talor-A avatar Dec 01 '23 20:12 Talor-A

I think we could add an API similar to <ModalOverlay>, but for popovers. By default, <Popover> would include the overlay, but if you want to customize it, you could wrap it in a <PopoverOverlay>.

devongovett avatar Dec 02 '23 16:12 devongovett

@devongovett That would be ideal!

deebov avatar Dec 04 '23 14:12 deebov

This is really needed as otherwise Popovers (Menus in our case) inside a Modal Dialog don't overlay the Modal Dialog which uses z-index as written in code examples from the documentation.

As a workaround I apply styles to [data-testid="underlay"] for now but TBH this feels hacky.

levrik avatar Sep 20 '24 10:09 levrik