From 11ee519b19fd5189c6291312b8083234575eaa68 Mon Sep 17 00:00:00 2001 From: Amelia Wattenberger Date: Thu, 20 Jan 2022 15:07:45 -0500 Subject: [PATCH] feat: focus first cell on column add --- src/components/grid.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/grid.tsx b/src/components/grid.tsx index a0674f5..105b804 100644 --- a/src/components/grid.tsx +++ b/src/components/grid.tsx @@ -779,6 +779,7 @@ const HeaderWrapper = function (props: CellProps) { focusedRowIndex, cellTypes, isEditable, + handleFocusedCellPositionChange, onHeaderCellChange, onHeaderDelete, onHeaderAdd, @@ -819,6 +820,13 @@ const HeaderWrapper = function (props: CellProps) { const onHeaderDeleteLocal = () => { onHeaderDelete(columnName); } + const onHeaderAddLocal = (newColumnName: string) => { + onHeaderAdd(newColumnName); + handleFocusedCellPositionChange([ + 0, + columnNames.length, + ]) + } return ( handleStickyColumnNameChange(columnName)} onFilterChange={(value: FilterValue) => {