Skip to content

Commit c5b71a0

Browse files
committed
Calendar: avoid opening menu on unselected component
The javascript 'contextmenu' event is not consistent with its order. On some machines, it is triggered right after right-click 'mousedown', on other machines after 'mouseup'. This can lead to an unexpected behavior, when the right-click is started outside a component and is finished on a component. Because the selection is applied on 'mousedown', no component is selected, but the context menu of the component is opened. This change cancels the opening of the popup window when this case occurs. 451116
1 parent bd0a7a1 commit c5b71a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

eclipse-scout-core/src/calendar/Calendar.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
2+
* Copyright (c) 2010, 2026 BSI Business Systems Integration AG
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -1562,6 +1562,11 @@ export class Calendar extends Widget implements CalendarModel {
15621562
if (!this.rendered || !this.attached || !this._calculateContextMenuVisible(event)) { // check needed because function is called asynchronously
15631563
return;
15641564
}
1565+
if (allowedType === Calendar.MenuType.CalendarComponent && !this.selectedComponent) {
1566+
// When right click is started outside the component and released on the component,
1567+
// no component is selected -> no context menu is opened
1568+
return;
1569+
}
15651570
let filteredMenus = menus.filter(this.menus, [allowedType], {
15661571
onlyVisible: true,
15671572
defaultMenuTypes: this.defaultMenuTypes

0 commit comments

Comments
 (0)