Describe the bug
Clicking on an anchor link inside a Modal causes it to close. On further inspection, I detected that clicking the link calls Modal's onClose with the identifier _clickedOverlay_
Expected Behavior
Clicking an anchor link should not call _clickedOverlay_ event, and thus not close the Modal.
To Reproduce
<Modal isOpen={true} onClose={console.log}>
<ModalOverlay />
<ModalContent>
<a href="#">Secondary Action</a>
</ModalContent>
</Modal>
Suggested solution(s)
I checked the code and it seems that the overlay (which throws _clickedOverlay_ event) is a parent of the Modal content, and somehow the click event on the anchor link is not prevented from bubbling up to this overlay. Maybe this should be a sibling of the content and not a parent. Although this could cause issues for the escape key mechanism.
Desktop (please complete the following information):
Additional context
This also happens in Drawer component, which inherits from Modal
Hi @Machinezero,
Thanks for this issue. Your thoughts and recommended solutions are valid.
We've solved this in preparation for the next release.
Any update regarding this bug? I also faced this issue. Needed to call stopPropagation manually
This has been released in v1.0.0.rc-0
Most helpful comment
Hi @Machinezero,
Thanks for this issue. Your thoughts and recommended solutions are valid.
We've solved this in preparation for the next release.