diff --git a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts b/apps/client/src/widgets/view_widgets/table_view/context_menu.ts index 910c65895..74f480cb7 100644 --- a/apps/client/src/widgets/view_widgets/table_view/context_menu.ts +++ b/apps/client/src/widgets/view_widgets/table_view/context_menu.ts @@ -11,6 +11,13 @@ import type Component from "../../../components/component.js"; export function setupContextMenu(tabulator: Tabulator, parentNote: FNote) { tabulator.on("rowContext", (e, row) => showRowContextMenu(e, row, parentNote)); tabulator.on("headerContext", (e, col) => showColumnContextMenu(e, col, tabulator)); + + // Pressing the expand button prevents bubbling and the context menu remains menu when it shouldn't. + if (tabulator.options.dataTree) { + const dismissContextMenu = () => contextMenu.hide(); + tabulator.on("dataTreeRowExpanded", dismissContextMenu); + tabulator.on("dataTreeRowCollapsed", dismissContextMenu); + } } function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator: Tabulator) {