davidtheclark / davidtheclark/react-aria-modal

Click on underlay closes multiple modals

Open
#88 4 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
1k
Forks
94
PR merge metrics
No merged PRs in 30d

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](https://github.com/davidtheclark/react-aria-modal/blob/master/src/react-aria-modal.js#L90-L99).

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.