diff --git a/packages/compass-components/src/components/virtual-grid.tsx b/packages/compass-components/src/components/virtual-grid.tsx index 3384bf34b71..a1201e08e59 100644 --- a/packages/compass-components/src/components/virtual-grid.tsx +++ b/packages/compass-components/src/components/virtual-grid.tsx @@ -9,10 +9,7 @@ import React, { import { css, cx } from '@leafygreen-ui/emotion'; import { FixedSizeList } from 'react-window'; import { useDOMRect } from '../hooks/use-dom-rect'; -import { - useVirtualGridArrowNavigation, - useVirtualRovingTabIndex, -} from '../hooks/use-virtual-grid'; +import { useVirtualGridArrowNavigation } from '../hooks/use-virtual-grid'; import { mergeProps } from '../utils/merge-props'; type RenderItem = React.FunctionComponent< @@ -49,6 +46,10 @@ type VirtualGridProps = { * correctly */ renderItem: RenderItem; + /** + * Custom grid item key (default is item index) + */ + itemKey?: (index: number) => React.Key | null | undefined; /** * Header content height */ @@ -77,7 +78,11 @@ type VirtualGridProps = { cell?: string; }; - itemKey?: (index: number) => React.Key | null | undefined; + /** + * Set to `false` of you want the last focused item to be preserved between + * focus / blur (default: true) + */ + resetActiveItemOnBlur?: boolean; }; const GridContext = createContext< @@ -130,10 +135,10 @@ const GridWithHeader = forwardRef< }} {...props} > -