diff --git a/apps/common/main/lib/extend/Bootstrap.js b/apps/common/main/lib/extend/Bootstrap.js index a39389bb3..1ecfa0ee1 100755 --- a/apps/common/main/lib/extend/Bootstrap.js +++ b/apps/common/main/lib/extend/Bootstrap.js @@ -16,12 +16,12 @@ function onDropDownKeyDown(e) { if ($parent.hasClass('no-stop-propagate') && arguments.length>1 && arguments[1] instanceof jQuery.Event) { e = arguments[1]; - if ( /^(38|40|27|13|9)$/.test(e.keyCode)) { + if ( /^(38|40|27|13|9)$/.test(e.keyCode) && !e.ctrlKey && !e.altKey) { patchDropDownKeyDownAdditional.call(this, e); e.preventDefault(); e.stopPropagation(); } - } else if ( !$parent.hasClass('no-stop-propagate') || /^(38|40|27|13|9)$/.test(e.keyCode)) { + } else if ( !$parent.hasClass('no-stop-propagate') || /^(38|40|27|13|9)$/.test(e.keyCode) && !e.ctrlKey && !e.altKey) { patchDropDownKeyDown.call(this, e); e.preventDefault(); e.stopPropagation(); diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index a447b33f8..62bccec61 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1303,9 +1303,6 @@ define([ menu.addItem(mnu); }); - - Common.UI.Menu.Manager.hideAll(); - if (!menu.rendered) { // Prepare menu container if (menuContainer.length < 1) { @@ -1313,15 +1310,15 @@ define([ documentHolderView.cmpEl.append(menuContainer); } - menu.render(menuContainer); - menu.cmpEl.attr({tabindex: "-1"}); + menu.onAfterKeydownMenu = function(e) { + if (e.keyCode == Common.UI.Keys.RETURN && (e.ctrlKey || e.altKey)) return; + Common.UI.Menu.prototype.onAfterKeydownMenu.call(menu, e); - menu.parentEl.on('keydown.after.bs.dropdown', _.bind(function(e) { var li; if (arguments.length>1 && arguments[1] instanceof jQuery.Event) {// when typing in cell editor e = arguments[1]; if (menuContainer.hasClass('open')) { - if (e.keyCode == Common.UI.Keys.TAB || e.keyCode == Common.UI.Keys.RETURN) + if (e.keyCode == Common.UI.Keys.TAB || e.keyCode == Common.UI.Keys.RETURN && !e.ctrlKey && !e.altKey) li = menuContainer.find('a.focus').closest('li'); else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) { var innerEl = menu.cmpEl, @@ -1340,12 +1337,19 @@ define([ } } else if (e.keyCode == Common.UI.Keys.TAB) li = $(e.target).closest('li'); - + if (li) { if (li.length>0) li.click(); Common.UI.Menu.Manager.hideAll(); } - }, me)); + }; + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + + menu.on('hide:after', function() { + if (Common.Utils.isIE) me.documentHolder.focus(); + }); } var coord = me.api.asc_getActiveCellCoord(), @@ -1355,9 +1359,14 @@ define([ menu.alignPosition(); var infocus = me.cellEditor.is(":focus"); + if (!menu.isVisible()) + Common.UI.Menu.Manager.hideAll(); _.delay(function() { - menu.show(); - if (menu.scroller) menu.scroller.scrollTop(0); + if (!menu.isVisible()) menu.show(); + if (menu.scroller) { + menu.scroller.update({alwaysVisibleY: true}); + menu.scroller.scrollTop(0); + } if (infocus) { me.cellEditor.focus(); _.delay(function() { diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index fa238794e..4787b97e1 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -482,8 +482,6 @@ define([ minScrollbarLength : 40, alwaysVisibleY: true }); - }).on('show:after', function () { - this.scroller.update({alwaysVisibleY: true}); }); me.fireEvent('createdelayedelements', [me]);