Manage escape key on UniqueDialog

On escape key pressed, we call close method and reject the promise like a
cancel.

issue8947
review266611002
This commit is contained in:
Cédric Krier committed 2020-01-13 23:51:27 +01:00
1 parent d6f3165617
commit d3ec7bf2d0
1 file changed
+7 -1
+7 -1
View File
@@ -2852,7 +2852,7 @@
this.running = false;
},
build_dialog: function() {
var dialog = new Sao.Dialog('', this.class_);
var dialog = new Sao.Dialog('', this.class_, undefined, false);
return dialog;
},
run: function() {
@@ -2873,6 +2873,12 @@
dialog.modal.find('input,select')
.filter(':visible').first().focus();
});
dialog.modal.on('keydown', function(e) {
if (e.which == Sao.common.ESC_KEYCODE) {
this.close(dialog);
prm.reject();
}
}.bind(this));
return prm;
},
close: function(dialog) {