From 3524b57ed1962dc5c8a20d0cbfc35d95989e56ad Mon Sep 17 00:00:00 2001 From: Shpileva Yuliya Date: Tue, 21 Jan 2025 15:53:28 +0400 Subject: [PATCH] dxGantt: fix context menu to make it accessible (T1269329) (#28773) --- packages/devextreme/js/ui/gantt/ui.gantt.treelist.js | 3 ++- .../DevExpress.ui.widgets/ganttParts/contextMenu.tests.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/devextreme/js/ui/gantt/ui.gantt.treelist.js b/packages/devextreme/js/ui/gantt/ui.gantt.treelist.js index 6523f8585c10..c7b092277d91 100644 --- a/packages/devextreme/js/ui/gantt/ui.gantt.treelist.js +++ b/packages/devextreme/js/ui/gantt/ui.gantt.treelist.js @@ -109,7 +109,7 @@ export class GanttTreeList { if(e.row?.rowType === 'data') { this.setOption('selectedRowKeys', [e.row.data[this._gantt.option('tasks.keyExpr')]]); } - e.items = []; + const info = { cancel: false, event: e.event, @@ -118,6 +118,7 @@ export class GanttTreeList { position: { x: e.event.pageX, y: e.event.pageY } }; this._gantt._showPopupMenu(info); + e.event.preventDefault(); } _getHeight() { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/ganttParts/contextMenu.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/ganttParts/contextMenu.tests.js index 4a1094690568..063d22d8ac40 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/ganttParts/contextMenu.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/ganttParts/contextMenu.tests.js @@ -40,7 +40,7 @@ QUnit.module('Context Menu', moduleConfig, () => { assert.equal(getContextMenuElement().length, 0, 'menu is hidden on create'); const $cellElement = $(this.instance._treeList.getCellElement(0, 0)); $cellElement.trigger('contextmenu'); - assert.equal(getContextMenuElement().length, 2, 'menu is visible after right click in tree list'); + assert.equal(getContextMenuElement().length, 1, 'menu is visible after right click in tree list'); }); test('shown at correct position', function(assert) { this.createInstance(options.allSourcesOptions);