[DE] Add focus manager.

[Combobox] Fix focus when no items are selected
This commit is contained in:
Julia Radzhabova 2020-09-27 13:48:21 +03:00
parent e59e7c09c9
commit 296d270348
2 changed files with 10 additions and 3 deletions

View file

@ -321,6 +321,9 @@ define([
$list.scrollTop(height); $list.scrollTop(height);
} }
setTimeout(function(){$selected.find('a').focus();}, 1); 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) if (this.scroller)

View file

@ -48,7 +48,8 @@ define([
height: 196, height: 196,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'] buttons: ['ok', 'cancel'],
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -103,11 +104,14 @@ define([
style : 'width: 100%;', style : 'width: 100%;',
menuStyle : 'width: 100%; max-height: 210px;', menuStyle : 'width: 100%; max-height: 210px;',
editable : false, editable : false,
takeFocusOnClose: true,
cls : 'input-group-nr', cls : 'input-group-nr',
data : this.options.formats, data : this.options.formats,
disabled : (this.options.formats.length==0) disabled : (this.options.formats.length==0)
}); });
this.cmbNextStyle.setValue(-1); this.cmbNextStyle.setValue(-1);
this.focusManager.add([this.inputTitle, this.cmbNextStyle], '.form-control');
}, },
show: function() { show: function() {
@ -115,7 +119,7 @@ define([
var me = this; var me = this;
_.delay(function(){ _.delay(function(){
me.inputTitle.cmpEl.find('input').focus(); me.inputTitle.focus();
},500); },500);
}, },
@ -143,7 +147,7 @@ define([
if (state == 'ok') { if (state == 'ok') {
var checkurl = this.inputTitle.checkValidate(); var checkurl = this.inputTitle.checkValidate();
if (checkurl !== true) { if (checkurl !== true) {
this.inputTitle.cmpEl.find('input').focus(); this.inputTitle.focus();
return; return;
} }
} }