Possible to prevent modal from disappearing by clicking off it?
Opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
I'm using a modal to present a form to the user. Accidentally clicking off the form will make it disappear which is frustrating.
Describe the solution you'd like
An options field or boolean flag that you can use to disable click-to-exit modal dialogs.
Describe alternatives you've considered
Tried switching to a confirm popup, but I don't want OK/Cancel buttons.
Additional context
I'm open to JS or CSS workarounds on my end
document.addEventListener('click', function(event) {
if (event.target === document.getElementById("awn-popup-wrapper")) {
if (!confirm("Close the dialog?")) {
event.stopPropagation();
}
}
}, true);
works for me
Hello.
I added that improvement. Waiting on @f3oall to add a NPM_TOKEN so I can run releases :)
document.addEventListener('click', function(event) { if (event.target === document.getElementById("awn-popup-wrapper")) { if (!confirm("Close the dialog?")) { event.stopPropagation(); } } }, true);
works for me
Thank you! I was looking for something to stop closing the modal by clicking in the overlay... they should implement this feature!!