[SSE] Set focus to palette on menu open

This commit is contained in:
Julia Radzhabova 2022-04-28 17:18:06 +03:00
parent 503fdc3db7
commit 7690bd393a
4 changed files with 16 additions and 3 deletions

View file

@ -132,6 +132,15 @@ define([
this.updateColors(this.options.updateColorsArr[0], this.options.updateColorsArr[1]);
if (this.options.value)
this.select(this.options.value, true);
if (this.options.outerMenu && this.options.outerMenu.focusOnShow && this.options.outerMenu.menu) {
el.addClass('focused');
this.options.outerMenu.menu.on('show:after', function(menu) {
_.delay(function() {
me.showLastSelected();
me.focus();
}, 10);
});
}
this.updateCustomColors();
el.closest('.btn-group').on('show.bs.dropdown', _.bind(this.updateCustomColors, this));
el.closest('.dropdown-submenu').on('show.bs.dropdown', _.bind(this.updateCustomColors, this));

View file

@ -128,8 +128,9 @@ function patchDropDownKeyDown(e) {
var mnu = $('> [role=menu]', li),
$subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'),
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'),
$palette = mnu.find('> li:not(.divider):not(.disabled):visible .theme-colorpalette.focused'),
$internal_menu = mnu.find('> li:not(.divider):not(.disabled):visible ul.internal-menu');
if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1)
if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1 && $palette.length<1)
($subitems.index($subitems.filter(':focus'))<0) && $subitems.eq(0).focus();
}, 250);
}

View file

@ -548,7 +548,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
this.btnBorders.on('click', _.bind(this.onBorders, this));
this.mnuBorderColorPicker = new Common.UI.ThemeColorPalette({
el: $('#format-rules-borders-menu-bordercolor'),
outerMenu: {menu: this.mnuBorderColor.menu, index: 0}
outerMenu: {menu: this.mnuBorderColor.menu, index: 0, focusOnShow: true}
});
this.mnuBorderColor.menu.setInnerMenu([{menu: this.mnuBorderColorPicker, index: 0}]);
this.mnuBorderColorPicker.on('select', _.bind(this.onBordersColor, this));

View file

@ -377,12 +377,15 @@ define([
}).on('render:after', function(btn) {
me.mnuTabColor = new Common.UI.ThemeColorPalette({
el: $('#id-tab-menu-color'),
outerMenu: {menu: menuColorItems, index: 0},
outerMenu: {menu: menuColorItems, index: 0, focusOnShow: true},
transparent: true
});
menuColorItems.setInnerMenu([{menu: me.mnuTabColor, index: 0}]);
me.mnuTabColor.on('select', function(picker, color) {
me.fireEvent('sheet:setcolor', [color]);
setTimeout(function(){
me.tabMenu.hide();
}, 1);
});
});