Skip to content

Commit 5a431b9

Browse files
committed
refactor: override global contextmenu handler in submenu
Recent listener-lifecycle refactor moved the global "contextmenu" binding out of `_openedChanged`, so submenu must override `__onGlobalContextMenu` directly to ignore those events. Drop the now-redundant `__restoreOpened` reset in `connectedCallback` since the flag is recomputed on each disconnect.
1 parent 66147e6 commit 5a431b9

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/context-menu/src/vaadin-context-menu-mixin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ export const ContextMenuMixin = (superClass) =>
150150
// Restore opened state if overlay was opened when disconnecting
151151
if (this.__restoreOpened) {
152152
this._setOpened(true);
153-
this.__restoreOpened = false;
154153
}
155154
}
156155

packages/menu-bar/src/vaadin-menu-bar-submenu.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ class MenuBarSubmenu extends ContextMenuMixin(ThemePropertyMixin(PolylitMixin(Li
102102
}
103103

104104
/**
105-
* Overriding the observer to not add global "contextmenu" listener.
105+
* Overriding the observer to not toggle user-select on the host.
106106
* @override
107107
*/
108108
_openedChanged() {
109109
// Do nothing
110110
}
111111

112+
/**
113+
* Overriding the handler to not react to global "contextmenu" events.
114+
* @override
115+
*/
116+
__onGlobalContextMenu() {
117+
// Do nothing
118+
}
119+
112120
/**
113121
* Overriding the public method to reset expanded button state.
114122
*/

0 commit comments

Comments
 (0)