From 901669b802263c4896c2dfaeef41e21bfcfea7de Mon Sep 17 00:00:00 2001 From: Sychev Andrey <44414066+SychevAndrey@users.noreply.github.com> Date: Tue, 19 Aug 2025 12:03:41 +0200 Subject: [PATCH] dbeaver/pro#6472 fix: restore focus after menu actions and on syncFocus (#3657) * dbeaver/pro#6472 fix: restore focus after menu actions and on syncFocus * dbeaver/pro#6472 refactor: revert changes with using restoreFocus function from context * dbeaver/pro#6472 fix: delete row from a context menu works as with a hotkey set to null and revert also keep focus in place * Revert "dbeaver/pro#6472 fix: delete row from a context menu works as with a hotkey" This reverts commit f54abf39561d408e651fbc880e9899e42129eb46. --------- Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com> --- .../DataGridContextMenuCellEditingService.ts | 2 +- .../plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx | 3 ++- .../src/TableViewer/IDataPresentationActions.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts index d3678eabf5..2676c457f1 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuCellEditingService.ts @@ -37,7 +37,7 @@ export class DataGridContextMenuCellEditingService { constructor( private readonly actionService: ActionService, private readonly menuService: MenuService, - ) {} + ) { } register(): void { this.menuService.addCreator({ diff --git a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx index d25ad3bc61..5dc72d11df 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx +++ b/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridTable.tsx @@ -200,6 +200,7 @@ export const DataGridTable = observer(function DataGridT // TODO: we need this delay to update focus after render rows update setTimeout(() => { handlers.focusCell(data.key); + setTimeout(() => restoreFocus(), 1); }, 1); } } @@ -210,7 +211,7 @@ export const DataGridTable = observer(function DataGridT return () => { tableData.editor.action.removeHandler(syncEditor); }; - }, [tableData.editor, selectionAction, handlers, tableData]); + }, [tableData.editor, selectionAction, handlers, tableData, restoreFocus]); const handleFocusChange = (position: ICellPosition) => { focusedCell.current = position; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/IDataPresentationActions.ts b/webapp/packages/plugin-data-viewer/src/TableViewer/IDataPresentationActions.ts index 752e6ec2d2..28ff12175a 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/IDataPresentationActions.ts +++ b/webapp/packages/plugin-data-viewer/src/TableViewer/IDataPresentationActions.ts @@ -1,6 +1,6 @@ /* * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2024 DBeaver Corp and others + * Copyright (C) 2020-2025 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License.