From 7dce6d79ae3c201cede6b0993f2d03a576e2c108 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 15 Oct 2020 20:21:56 +0300 Subject: [PATCH] Fix focus --- .../main/app/view/ListSettingsDialog.js | 21 +++++++++++++++++-- .../main/app/view/RemoveDuplicatesDialog.js | 6 +++++- .../main/app/view/SlicerAddDialog.js | 6 ++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/view/ListSettingsDialog.js b/apps/documenteditor/main/app/view/ListSettingsDialog.js index ff07be93b..6ff07c81b 100644 --- a/apps/documenteditor/main/app/view/ListSettingsDialog.js +++ b/apps/documenteditor/main/app/view/ListSettingsDialog.js @@ -205,6 +205,7 @@ define([ editable : false, template : _.template(template.join('')), itemsTemplate: _.template(itemsTemplate.join('')), + takeFocusOnClose: true, data : [ { displayValue: this.txtNone, value: Asc.c_oAscNumberingFormat.None }, { displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal }, @@ -274,7 +275,8 @@ define([ { value: AscCommon.align_Left, displayValue: this.textLeft }, { value: AscCommon.align_Center, displayValue: this.textCenter }, { value: AscCommon.align_Right, displayValue: this.textRight } - ] + ], + takeFocusOnClose: true }); this.cmbAlign.on('selected', _.bind(function (combo, record) { if (this._changedProps) @@ -308,7 +310,8 @@ define([ { value: 48, displayValue: "48" }, { value: 72, displayValue: "72" }, { value: 96, displayValue: "96" } - ] + ], + takeFocusOnClose: true }); this.cmbSize.on('selected', _.bind(function (combo, record) { if (this._changedProps) { @@ -326,6 +329,7 @@ define([ this.levelsList = new Common.UI.ListView({ el: $('#levels-list', this.$window), store: new Common.UI.DataViewStore(levels), + tabindex: 1, itemTemplate: _.template('
<%= (value+1) %>
') }); this.levelsList.on('item:select', _.bind(this.onSelectLevel, this)); @@ -333,6 +337,10 @@ define([ this.afterRender(); }, + getFocusedComponents: function() { + return [this.cmbFormat, this.cmbAlign, this.cmbSize, {cmp: this.levelsList, selector: '.listview'}]; + }, + afterRender: function() { this.updateThemeColors(); this._setDefaults(this.props); @@ -346,6 +354,15 @@ define([ }); }, + show: function() { + Common.UI.Window.prototype.show.apply(this, arguments); + + var me = this; + _.delay(function(){ + (me.type>0) ? me.cmbFormat.focus() : me.cmbAlign.focus(); + },100); + }, + updateThemeColors: function() { this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, diff --git a/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js index cd253f42b..ed9789c37 100644 --- a/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js +++ b/apps/spreadsheeteditor/main/app/view/RemoveDuplicatesDialog.js @@ -120,7 +120,7 @@ define([ 'item:select': this.onCellCheck.bind(this) }); this.columnsList.onKeyDown = _.bind(this.onListKeyDown, this); - + this.columnsList.on('entervalue', _.bind(this.onPrimary, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.afterRender(); }, @@ -258,6 +258,10 @@ define([ this.chHeaders.setValue(!!props.asc_getHasHeaders(), true); this.updateColumnsList(); } + var me = this; + _.delay(function () { + me.columnsList.focus(); + }, 100, this); }, getSettings: function () { diff --git a/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js b/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js index b4d0078ed..5811a70e4 100644 --- a/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js +++ b/apps/spreadsheeteditor/main/app/view/SlicerAddDialog.js @@ -99,6 +99,7 @@ define([ 'item:select': this.onCellCheck.bind(this) }); this.columnsList.onKeyDown = _.bind(this.onListKeyDown, this); + this.columnsList.on('entervalue', _.bind(this.onPrimary, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.afterRender(); @@ -191,6 +192,11 @@ define([ if (props) { this.updateColumnsList(props); } + + var me = this; + _.delay(function () { + me.columnsList.focus(); + }, 100, this); }, getSettings: function () {