Is there a way to prevent the modal from closing on click?

I’m using the openModal( ) function to open modals with dynamic URLs. These modals contain fields which must be filled out. It’s detrimental to the user experience for the modal to close out when someone clicks on the page space outside of the modal. This erases all the inputs the user had already gone through. I was curious if there was a way to keep the modal open when a visitor clicks outside the modal onto the page. The only way I would like them to be able to close the modal is the ‘x’ in the top right corner.

1 Like

Hi,
Looks like this option is not exposed at the moment.
Could you please explain the difference in experience between closing with the ‘x’ button vs. clicking outside? Is it to prevent accidental clicks?

Hi Tomer,

Thank you for the response. Its exactly to eliminate accidental clicks. I’m using the openModal function to launch a third party ecommerce embed which allows a customer to checkout without leaving the website. This checkout process involves putting in a fair amount of user information and its a very poor user experience to accidentally lose all the information you’ve put into the form.

Thank you for looking into this. Your assistance is greatly appreciated.

Hi,
You can submit it as a feature request in our requests category on the forum.
In the meantime, maybe you can look into saving the user data and restoring it if the user accidentally closed the modal.

Thank you for your help Tomer

I posted this to the feature request forum here: https://www.wix.com/code/home/forum/feature-requests/prevent-the-modal-from-closing-when-you-click-the-page

Modal must be an alternative to light box, performance of ligth box must be better.