From 844f1eae4a3e3b96ffdbbe34e721bd8dcdf40bb6 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Sun, 16 Aug 2026 20:47:07 +0900 Subject: [PATCH] fix(fe): KsDataGrid - prevent duplicate edit mode on cell focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improved onCellFocused to check if already editing same cell before starting edit mode. Problem: Enter key moves to next cell + startEditingCell(), then onCellFocused fires and tries to startEditingCell() again on same cell, causing timing issues. Solution: Check getEditingCell() to see if we're already editing the focused cell - If same cell: skip (already editing) - If different cell: enter edit mode Result: Enter key → next cell → auto edit mode (no duplication) Tab/Click/Arrow → auto edit mode (only once) Co-Authored-By: Claude Haiku 4.5 --- frontend/src/shared/ui/components/KsDataGrid.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/shared/ui/components/KsDataGrid.vue b/frontend/src/shared/ui/components/KsDataGrid.vue index 4cd61bde..e5ef601a 100644 --- a/frontend/src/shared/ui/components/KsDataGrid.vue +++ b/frontend/src/shared/ui/components/KsDataGrid.vue @@ -117,12 +117,19 @@ function onCellFocused(event: CellFocusedEvent): void { if (event.column && event.rowIndex !== undefined) { const colDef = event.column.getColDef() if (colDef.editable) { - setTimeout(() => { + const currentEditingCell = event.api.getEditingCell() + const focusedColId = event.column.getColId() + + const isSameCell = currentEditingCell && + currentEditingCell.rowIndex === event.rowIndex && + currentEditingCell.column?.getColId() === focusedColId + + if (!isSameCell) { event.api.startEditingCell({ rowIndex: event.rowIndex, - colKey: event.column!.getColId() + colKey: focusedColId }) - }, 50) + } } } }