From 806a627fd7f94dc1f1e954c851d1ff3d3db00923 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Apr 2022 00:15:19 +0300 Subject: [PATCH] Fix context menu: don't update scroll or select items in parent menu when submenu show --- apps/common/main/lib/component/Menu.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index b5eb87827..03e16cc01 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -377,12 +377,12 @@ define([ onBeforeShowMenu: function(e) { Common.NotificationCenter.trigger('menu:show'); this.trigger('show:before', this, e); - this.alignPosition(); + (e && e.target===e.currentTarget) && this.alignPosition(); }, onAfterShowMenu: function(e) { this.trigger('show:after', this, e); - if (this.scroller) { + if (this.scroller && e && e.target===e.currentTarget) { var menuRoot = this.menuRoot; if (this.wheelSpeed===undefined) { var item = menuRoot.find('> li:first'), @@ -664,7 +664,7 @@ define([ if (top + menuH > docH + cg.top) { menuRoot.css('max-height', (docH - top) + 'px'); (!this.scroller) && (this.scroller = new Common.UI.Scroller({ - el: this.$el.find('.dropdown-menu '), + el: this.$el.find('> .dropdown-menu '), minScrollbarLength: 30, suppressScrollX: true, alwaysVisibleY: this.scrollAlwaysVisible @@ -975,12 +975,12 @@ define([ onBeforeShowMenu: function(e) { Common.NotificationCenter.trigger('menu:show'); this.trigger('show:before', this, e); - this.alignPosition(); + (e && e.target===e.currentTarget) && this.alignPosition(); }, onAfterShowMenu: function(e) { this.trigger('show:after', this, e); - if (this.scroller) { + if (this.scroller && e && e.target===e.currentTarget) { this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); var menuRoot = this.menuRoot, $selected = menuRoot.find('> li .checked');