Closed RezaErfani67 closed 9 months ago
@RezaErfani67 Yep, I also encountered this problem. After check the library I found the next line:
document.addEventListener("keyup", e => {
// Closing the last modal window when user pressed Escape
if (configuration.escClose && (e.key === "Escape" || e.code === "Escape")) {
const modal = getCurrentModal();
if (!modal) return;
closeById(modal.id, {esc: true}) // THIS LINE!
}
})
After change adding .catch everything work fine!
So, my solutiton:
import {config, closeById, getCurrentModal} from "jenesius-vue-modal";
config({
escClose: false // Turn off default closing
})
document.addEventListener("keyup", e => {
// Closing the last modal window when user pressed Escape
if (e.key === "Escape" || e.code === "Escape") {
const modal = getCurrentModal();
if (!modal) return;
closeById(modal.id, {esc: true}).catch(() => {})
}
})
But it definitely needs to be discussed with the library developer.
@RezaErfani67, thnx for notify about bug! The solution presented by @anshirko should work, but it should be fixed inside library. I will update version tomorrow and notify here!
thanks alot @anshirko @Jenesius
@RezaErfani67 Package version 1.9.3.
hi if i click outside of modal, it close correctly... but if i press ESC, it gives me error...
here is my code