davidtheclark/react-aria-modal

Click on underlay closes multiple modals

Open

#88 opened on Apr 24, 2019

View on GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (94 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (1,039 stars)
PR merge metrics
 (PR metrics pending)

Description

When underlayClickExits is true, clicking on the underlay around a modal will close the modal. This works perfectly when there's a single modal.

On the other hand, this works a little unexpectedly when there are multiple modals. In that case, if you have a modal and create a second modal and they both have underlayClickExits set to true, one would expect only the second modal to close when you click the underlay. If you click the underlay though in an area outside of both modals, then BOTH modals will close. I don't think this is the expected behavior.

Ideally, I think the modals should know when they're NOT the top most modal and add that being the top most modal as a condition in the checkUnderlayClick function.

I don't know if such a change would be backwards compatible but it's a feature I would find useful.

Contributor guide