Skip to content

Commit

Permalink
fix(pat modal): Fix close selector for default cancel buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Dec 9, 2022
1 parent 82a9e68 commit 4905251
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pat/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,18 @@ export default Base.extend({
self.emit("before-events-setup");

// Wire up events
$(
".modal-header > .modal-close, .modal-footer > .pattern-modal-buttons > .modal-close",
self.$modal
)
.off("click")
.on("click", function (e) {
self.$modal[0].querySelectorAll(
`.modal-header > .modal-close,
.modal-footer > .pattern-modal-buttons > .modal-close,
.modal-footer [name="form.buttons.Cancel" i]`
).forEach((el) => {
$(el).off("click").on("click", (e) => {
e.stopPropagation();
e.preventDefault();
$(e.target).trigger("destroy.plone-modal.patterns");
});
});


// form
if (options.form) {
Expand Down

0 comments on commit 4905251

Please sign in to comment.