From 296d2703489117f2906cc2f5bc024b0cb4635648 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sun, 27 Sep 2020 13:48:21 +0300 Subject: [PATCH] [DE] Add focus manager. [Combobox] Fix focus when no items are selected --- apps/common/main/lib/component/ComboBox.js | 3 +++ apps/documenteditor/main/app/view/StyleTitleDialog.js | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 8c3f5371b..ea12b5b55 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -321,6 +321,9 @@ define([ $list.scrollTop(height); } setTimeout(function(){$selected.find('a').focus();}, 1); + } else { + var me = this; + setTimeout(function(){me.cmpEl.find('ul li:first a').focus();}, 1); } if (this.scroller) diff --git a/apps/documenteditor/main/app/view/StyleTitleDialog.js b/apps/documenteditor/main/app/view/StyleTitleDialog.js index 2fdbb0189..9e9016256 100644 --- a/apps/documenteditor/main/app/view/StyleTitleDialog.js +++ b/apps/documenteditor/main/app/view/StyleTitleDialog.js @@ -48,7 +48,8 @@ define([ height: 196, style: 'min-width: 230px;', cls: 'modal-dlg', - buttons: ['ok', 'cancel'] + buttons: ['ok', 'cancel'], + focusManager: true }, initialize : function(options) { @@ -103,11 +104,14 @@ define([ style : 'width: 100%;', menuStyle : 'width: 100%; max-height: 210px;', editable : false, + takeFocusOnClose: true, cls : 'input-group-nr', data : this.options.formats, disabled : (this.options.formats.length==0) }); this.cmbNextStyle.setValue(-1); + + this.focusManager.add([this.inputTitle, this.cmbNextStyle], '.form-control'); }, show: function() { @@ -115,7 +119,7 @@ define([ var me = this; _.delay(function(){ - me.inputTitle.cmpEl.find('input').focus(); + me.inputTitle.focus(); },500); }, @@ -143,7 +147,7 @@ define([ if (state == 'ok') { var checkurl = this.inputTitle.checkValidate(); if (checkurl !== true) { - this.inputTitle.cmpEl.find('input').focus(); + this.inputTitle.focus(); return; } }