Closed
Description
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>