Skip to content

Commit 9c83255

Browse files
ENGCOM-6229: Allow modal triggers to be added after module initialization #25435
- Merge Pull Request #25435 from krzksz/magento2:modal-async-trigger - Merged commits: 1. 17a8aa9
2 parents dac1ea5 + 17a8aa9 commit 9c83255

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/Ui/view/base/web/js/modal

1 file changed

+4
-1
lines changed

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ define([
131131
this._createWrapper();
132132
this._renderModal();
133133
this._createButtons();
134-
$(this.options.trigger).on('click', _.bind(this.toggleModal, this));
134+
135+
if (this.options.trigger) {
136+
$(document).on('click', this.options.trigger, _.bind(this.toggleModal, this));
137+
}
135138
this._on(this.modal.find(this.options.modalCloseBtn), {
136139
'click': this.options.modalCloseBtnHandler ? this.options.modalCloseBtnHandler : this.closeModal
137140
});

0 commit comments

Comments
 (0)