From: Stas Vilchik Date: Mon, 23 Feb 2015 08:44:44 +0000 (+0100) Subject: improve modal windows X-Git-Tag: 5.1-RC1~106 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aacf4f3de8ccbcf83407ae75e1e2063bf63e0cc8;p=sonarqube.git improve modal windows --- diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-bulk-change-modal.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-bulk-change-modal.hbs index 28130ae5c8a..2da42ab924f 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-bulk-change-modal.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-bulk-change-modal.hbs @@ -34,6 +34,6 @@ diff --git a/server/sonar-web/src/main/hbs/issue/issue-rule.hbs b/server/sonar-web/src/main/hbs/issue/issue-rule.hbs index 7d2348469bd..ab2a2dc93df 100644 --- a/server/sonar-web/src/main/hbs/issue/issue-rule.hbs +++ b/server/sonar-web/src/main/hbs/issue/issue-rule.hbs @@ -28,5 +28,5 @@ diff --git a/server/sonar-web/src/main/hbs/nav/nav-shortcuts-help.hbs b/server/sonar-web/src/main/hbs/nav/nav-shortcuts-help.hbs index 0a7faf2acb1..74e10c7c0ae 100644 --- a/server/sonar-web/src/main/hbs/nav/nav-shortcuts-help.hbs +++ b/server/sonar-web/src/main/hbs/nav/nav-shortcuts-help.hbs @@ -38,5 +38,5 @@ diff --git a/server/sonar-web/src/main/hbs/source-viewer/source-viewer-measures.hbs b/server/sonar-web/src/main/hbs/source-viewer/source-viewer-measures.hbs index deb19d37419..0a2288ceca2 100644 --- a/server/sonar-web/src/main/hbs/source-viewer/source-viewer-measures.hbs +++ b/server/sonar-web/src/main/hbs/source-viewer/source-viewer-measures.hbs @@ -64,5 +64,5 @@ diff --git a/server/sonar-web/src/main/js/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/coding-rules/bulk-change-modal-view.js index b75170d3bb6..280a1927c14 100644 --- a/server/sonar-web/src/main/js/coding-rules/bulk-change-modal-view.js +++ b/server/sonar-web/src/main/js/coding-rules/bulk-change-modal-view.js @@ -63,6 +63,7 @@ define([ looper.done(function () { that.options.app.controller.fetchList(); that.$(that.ui.codingRulesSubmitBulkChange.selector).hide(); + that.$('.js-modal-close').focus(); }); }, diff --git a/server/sonar-web/src/main/js/common/modal-form.js b/server/sonar-web/src/main/js/common/modal-form.js index 39fac08a706..9cee5343443 100644 --- a/server/sonar-web/src/main/js/common/modal-form.js +++ b/server/sonar-web/src/main/js/common/modal-form.js @@ -14,6 +14,14 @@ define(['common/modals'], function (ModalView) { }); }, + onRender: function () { + ModalView.prototype.onRender.apply(this, arguments); + var that = this; + setTimeout(function () { + that.$(':tabbable').first().focus(); + }, 0); + }, + onFormSubmit: function (e) { e.preventDefault(); }, diff --git a/server/sonar-web/src/main/js/common/modals.js b/server/sonar-web/src/main/js/common/modals.js index 6886465c001..d03c2047886 100644 --- a/server/sonar-web/src/main/js/common/modals.js +++ b/server/sonar-web/src/main/js/common/modals.js @@ -10,7 +10,7 @@ define(function () { events: function () { return { - 'click .js-modal-close': 'close' + 'click .js-modal-close': 'onCloseClick' }; }, @@ -46,6 +46,11 @@ define(function () { key.setScope(this.keyScope); }, + onCloseClick: function (e) { + e.preventDefault(); + this.close(); + }, + renderOverlay: function () { var overlay = $('.' + this.overlayClassName); if (overlay.length === 0) {