diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 2e359e9cf..fce9a2ee1 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -242,18 +242,31 @@ define([ } }, + getFocusedComponents: function() { + var arr = []; + this.inputPwd && arr.push(this.inputPwd); + this.cmbEncoding && arr.push(this.cmbEncoding); + this.cmbDelimiter && arr.push(this.cmbDelimiter); + this.inputDelimiter && arr.push(this.inputDelimiter); + this.btnAdvanced && arr.push(this.btnAdvanced); + this.txtDestRange && arr.push(this.txtDestRange); + + return arr; + }, + show: function() { Common.UI.Window.prototype.show.apply(this, arguments); var me = this; if (this.type == Common.Utils.importTextType.DRM) { setTimeout(function(){ - me.inputPwd.cmpEl.find('input').focus(); + me.inputPwd.focus(); if (me.validatePwd) me.inputPwd.checkValidate(); }, 500); - } else if (this.type == Common.Utils.importTextType.Data) { - setTimeout(function(){me.txtDestRange.focus();}, 500); + } else { + var cmp = me.txtDestRange ? me.txtDestRange : (me.cmbEncoding ? me.cmbEncoding : me.cmbDelimiter); + cmp && setTimeout(function(){cmp.focus();}, 500); } }, @@ -346,7 +359,8 @@ define([ editable: false, disabled: true, search: true, - itemsTemplate: itemsTemplate + itemsTemplate: itemsTemplate, + takeFocusOnClose: true }); this.cmbEncoding.setDisabled(false); @@ -378,7 +392,8 @@ define([ {value: 1, displayValue: this.txtTab}, {value: 5, displayValue: this.txtSpace}, {value: -1, displayValue: this.txtOther}], - editable: false + editable: false, + takeFocusOnClose: true }); this.cmbDelimiter.setValue( (this.settings && this.settings.asc_getDelimiter()) ? this.settings.asc_getDelimiter() : 4); this.cmbDelimiter.on('selected', _.bind(this.onCmbDelimiterSelect, this)); diff --git a/apps/common/main/lib/view/PasswordDialog.js b/apps/common/main/lib/view/PasswordDialog.js index c552b5801..298981524 100644 --- a/apps/common/main/lib/view/PasswordDialog.js +++ b/apps/common/main/lib/view/PasswordDialog.js @@ -114,13 +114,12 @@ define([ } }, - show: function() { - Common.UI.Window.prototype.show.apply(this, arguments); + getFocusedComponents: function() { + return [this.inputPwd, this.repeatPwd]; + }, - var me = this; - setTimeout(function(){ - me.inputPwd.cmpEl.find('input').focus(); - }, 500); + getDefaultFocusableComponent: function () { + return this.inputPwd; }, onPrimary: function(event) { @@ -136,12 +135,12 @@ define([ if (this.handler) { if (state == 'ok') { if (this.inputPwd.checkValidate() !== true) { - this.inputPwd.cmpEl.find('input').focus(); + this.inputPwd.focus(); return; } if (this.inputPwd.getValue() !== this.repeatPwd.getValue()) { this.repeatPwd.checkValidate(); - this.repeatPwd.cmpEl.find('input').focus(); + this.repeatPwd.focus(); return; } } diff --git a/apps/spreadsheeteditor/main/app/view/SortDialog.js b/apps/spreadsheeteditor/main/app/view/SortDialog.js index be4347fbb..a791ed32c 100644 --- a/apps/spreadsheeteditor/main/app/view/SortDialog.js +++ b/apps/spreadsheeteditor/main/app/view/SortDialog.js @@ -144,7 +144,8 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template', '<% } %>', '', '' - ].join('')) + ].join('')), + tabindex: 1 }); this.sortList.createNewItem = function(record) { return new _CustomItem({ @@ -201,6 +202,14 @@ define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template', this._setDefaults(this.props); }, + getFocusedComponents: function() { + return [ this.btnAdd, this.btnDelete, this.btnCopy, this.btnOptions, this.btnUp, this.btnDown, this.sortList ]; + }, + + getDefaultFocusableComponent: function () { + return this.sortList; + }, + _setDefaults: function (props) { if (props) { this.sortOptions = {