react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

iOS - Clicking on overlay does not dismiss the modal

Open kukikiloke opened this issue 10 years ago • 26 comments

Summary: iOS - Clicking on overlay does not dismiss the modal

Steps to reproduce:

  1. Open the react modal with Safari or Chrome on an iOS device (was testing on iPod Touch 6th Gen/iOS 10)
  2. 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>

kukikiloke avatar Oct 21 '16 22:10 kukikiloke

@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 avatar Feb 24 '17 17:02 claydiffrient

@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!

felipegarcia92 avatar Feb 24 '17 17:02 felipegarcia92

Thanks so much @claydiffrient @diasbruno, much appreciated! 🙏

mi-lee avatar Feb 26 '17 19:02 mi-lee

A new version was released v1.7. Thank you all for helping! 🎉

diasbruno avatar Mar 02 '17 11:03 diasbruno

I'm still facing the same issue in 3.5.1 version

0xc0d3r avatar Aug 22 '18 11:08 0xc0d3r

The same issue was reproduced in 3.11.2. Fixed by adding position: absolute to modal class name.

AndrewGulidov avatar Oct 20 '20 17:10 AndrewGulidov