Skip to content

Commit f29aebb

Browse files
ENGCOM-6284: Fixed issue when escape key is pressed to close prompt #25349
- Merge Pull Request #25349 from konarshankar07/magento2:escapekey-issue-onprompt-close - Merged commits: 1. a4a2ff7 2. c42d48a 3. b8e0c42 4. d6995f7 5. c9f9757 6. 240fc19 7. da6b361 8. db51191 9. 3e25bd1 10. 633ea17 11. 5d676b6 12. 997959f 13. d3aa932 14. 65b2afe 15. 727679d 16. b41ea13 17. 552eaaf 18. ce6614e 19. c14fbed 20. 257eb00 21. b1ab6a9 22. 53fe8ee 23. 437fab3
2 parents 9003079 + 437fab3 commit f29aebb

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ define([
308308
* Close modal.
309309
* * @return {Element} - current element.
310310
*/
311-
closeModal: function () {
311+
closeModal: function (event, result) {//eslint-disable-line no-unused-vars
312312
var that = this;
313313

314314
this._removeKeyListener();

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ define([
5151
/**
5252
* Click handler.
5353
*/
54-
click: function () {
55-
this.closeModal();
54+
click: function (event) {
55+
this.closeModal(event);
5656
}
5757
}, {
5858
text: $.mage.__('OK'),
@@ -61,8 +61,8 @@ define([
6161
/**
6262
* Click handler.
6363
*/
64-
click: function () {
65-
this.closeModal(true);
64+
click: function (event) {
65+
this.closeModal(event, true);
6666
}
6767
}]
6868
},
@@ -75,7 +75,7 @@ define([
7575
this.options.validation = this.options.validation && this.options.validationRules.length;
7676
this._super();
7777
this.modal.find(this.options.modalContent).append(this.getFormTemplate());
78-
this.modal.find(this.options.modalCloseBtn).off().on('click', _.bind(this.closeModal, this, false));
78+
this.modal.find(this.options.modalCloseBtn).off().on('click', _.bind(this.closeModal, this));
7979

8080
if (this.options.validation) {
8181
this.setValidationClasses();
@@ -152,21 +152,23 @@ define([
152152
/**
153153
* Close modal window
154154
*/
155-
closeModal: function (result) {
155+
closeModal: function (event, result) {
156156
var value;
157157

158+
result = result || false;
159+
158160
if (result) {
159161
if (this.options.validation && !this.validate()) {
160162
return false;
161163
}
162164

163165
value = this.modal.find(this.options.promptField).val();
164-
this.options.actions.confirm.call(this, value);
166+
this.options.actions.confirm.call(event, value);
165167
} else {
166-
this.options.actions.cancel.call(this, result);
168+
this.options.actions.cancel.call(event, result);
167169
}
168170

169-
this.options.actions.always();
171+
this.options.actions.always(event);
170172
this.element.bind('promptclosed', _.bind(this._remove, this));
171173

172174
return this._super();
@@ -177,3 +179,4 @@ define([
177179
return $('<div class="prompt-message"></div>').html(config.content).prompt(config);
178180
};
179181
});
182+

0 commit comments

Comments
 (0)