diff options
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/components/common/modal-form.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/components/common/modal-form.js b/server/sonar-web/src/main/js/components/common/modal-form.js index 8fca522d40d..736621c9bed 100644 --- a/server/sonar-web/src/main/js/components/common/modal-form.js +++ b/server/sonar-web/src/main/js/components/common/modal-form.js @@ -29,6 +29,7 @@ define(['components/common/modals'], function (ModalView) { events: function () { return _.extend(ModalView.prototype.events.apply(this, arguments), { + 'keydown input,textarea,select': 'onInputKeydown', 'submit form': 'onFormSubmit' }); }, @@ -41,6 +42,13 @@ define(['components/common/modals'], function (ModalView) { }, 0); }, + onInputKeydown: function (e) { + if (e.keyCode === 27) { + // escape + this.destroy(); + } + }, + onFormSubmit: function (e) { e.preventDefault(); }, |