iOS - Clicking on overlay does not dismiss the modal
Summary: iOS - Clicking on overlay does not dismiss the modal
Steps to reproduce:
- Open the react modal with Safari or Chrome on an iOS device (was testing on iPod Touch 6th Gen/iOS 10)
- Click on the overlay. Modal is not closed and there is no error in the console.
Expected behavior: Clicking on the overlay should close the modal
Additional notes: Works fine on desktop and Android browsers.
As a temporary workaround, added
onAfterOpen={() => {
let el = document.querySelector('.ReactModal__Overlay');
el && el.addEventListener('click', closeModalFn);
}}
to handle the click event manually...
Code used:
<Modal
isOpen={this.state.isModalOpen}
onRequestClose={() => this.setState({ isModalOpen: false })}
style={modalStyle}
shouldCloseOnOverlayClick={true}
>
{children}
</Modal>
@felipegarcia92 I am working on picking over the fixes to the v1 branch. I am one commit away from completion. I'm hoping to finish it up this weekend then cut a 1.7 release.
@claydiffrient Thanks for the reply, sounds great, I think I'll just wait since this library has helped a great deal with my app. Thanks for that too haha!
Thanks so much @claydiffrient @diasbruno, much appreciated! 🙏
A new version was released v1.7. Thank you all for helping! 🎉
I'm still facing the same issue in 3.5.1 version
The same issue was reproduced in 3.11.2. Fixed by adding position: absolute to modal class name.