diff --git a/v3/src/components/case-table/collection-table.tsx b/v3/src/components/case-table/collection-table.tsx index d66dc72af0..a94e4e120c 100644 --- a/v3/src/components/case-table/collection-table.tsx +++ b/v3/src/components/case-table/collection-table.tsx @@ -84,7 +84,7 @@ export const CollectionTable = observer(function CollectionTable(props: IProps) args.onClose(true) // prevent RDG from handling the event event.preventGridDefault() - navigateToNextRow() + navigateToNextRow(event.shiftKey) } } diff --git a/v3/src/components/case-table/use-selected-cell.ts b/v3/src/components/case-table/use-selected-cell.ts index 272ef2019c..112e1d2612 100644 --- a/v3/src/components/case-table/use-selected-cell.ts +++ b/v3/src/components/case-table/use-selected-cell.ts @@ -21,13 +21,16 @@ export function useSelectedCell(gridRef: React.RefObject, : undefined }, []) - const navigateToNextRow = useCallback(() => { + const navigateToNextRow = useCallback((back = false) => { if (selectedCell.current?.columnId) { const idx = columns.findIndex(column => column.key === selectedCell.current?.columnId) - const rowIdx = selectedCell.current.rowIdx + 1 + const rowIdx = Math.max(0, selectedCell.current.rowIdx + (back ? -1 : 1)) const position = { idx, rowIdx } - gridRef.current?.selectCell(position, true) - collectionTableModel?.scrollRowIntoView(rowIdx) + // setTimeout so it occurs after handling of current event completes + setTimeout(() => { + collectionTableModel?.scrollRowIntoView(rowIdx) + gridRef.current?.selectCell(position, true) + }) } }, [collectionTableModel, columns, gridRef])