fix: KsDataGrid - ensure edit mode starts after focusing and Enter key navigation

- Add setTimeout in focusRow to ensure DOM updates before startEditingCell
- Add startEditingCell after tabToNextCell in Enter key handler
- Ensures smooth edit mode transition: focus → edit mode immediately
This commit is contained in:
2026-08-16 21:22:40 +09:00
parent 4f20ca24d2
commit 55341661fc
@@ -117,6 +117,13 @@ function onCellKeyDown(event: any): void {
event.event.preventDefault()
event.api.stopEditing(false)
event.api.tabToNextCell(false)
setTimeout(() => {
const focusedCell = event.api.getFocusedCell()
if (focusedCell && focusedCell.rowIndex !== null) {
event.api.startEditingCell({ rowIndex: focusedCell.rowIndex, colKey: focusedCell.column.getColId() })
}
}, 0)
}
}
@@ -152,8 +159,11 @@ function focusRow(rowIndex: number, colKey?: string): void {
gridApi.value.ensureIndexVisible(rowIndex)
gridApi.value.setFocusedCell(rowIndex, col)
if (col) {
gridApi.value.startEditingCell({ rowIndex, colKey: col })
setTimeout(() => {
gridApi.value?.startEditingCell({ rowIndex, colKey: col })
}, 0)
}
}