diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-06-11 17:16:06 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-06-11 17:16:06 +0200 |
commit | 7409117176d458f8df47f2ce69e495aa8d595e83 (patch) | |
tree | 51e50f7ea85405edf5e02a77aff8bbbac66de5e1 /server/sonar-web/src/main/js | |
parent | cef90a32b3dcf0d9242fcbdc394548227221d472 (diff) | |
download | sonarqube-7409117176d458f8df47f2ce69e495aa8d595e83.tar.gz sonarqube-7409117176d458f8df47f2ce69e495aa8d595e83.zip |
close modal form by pressing escape even if input is focused
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(); }, |