Improved the backdrop removal of the modal after modal submission

This commit is contained in:
Jan Böhmer 2023-01-07 20:58:13 +01:00
parent 436aff7533
commit 89a4846259
2 changed files with 11 additions and 11 deletions

View file

@ -4,16 +4,7 @@ import {Modal} from "bootstrap";
export default class extends Controller
{
connect() {
this.element.addEventListener('show.bs.modal', event => this._handleModalOpen(event));
//Register an event to remove the backdrop, when the form is submitted
const form = this.element.querySelector('form');
form.addEventListener('submit', event => {
//Remove the backdrop
document.querySelector('.modal-backdrop').remove();
});
}
_handleModalOpen(event) {