diff --git a/src/components/Select/__stories__/SelectShowcase.tsx b/src/components/Select/__stories__/SelectShowcase.tsx index ffdcccf65a..6dee20adf7 100644 --- a/src/components/Select/__stories__/SelectShowcase.tsx +++ b/src/components/Select/__stories__/SelectShowcase.tsx @@ -190,8 +190,8 @@ export const SelectShowcase = (props: SelectProps) => { code={[EXAMPLE_DISABLED_OPTIONS]} selectProps={props} > - - + + diff --git a/src/components/Select/utils.tsx b/src/components/Select/utils.tsx index 8e613ea1ea..87eca7e330 100644 --- a/src/components/Select/utils.tsx +++ b/src/components/Select/utils.tsx @@ -1,7 +1,8 @@ import React from 'react'; import {KeyCode} from '../../constants'; -import type {List, ListItemData} from '../List'; +import {List} from '../List'; +import type {ListItemData} from '../List'; import {GROUP_ITEM_MARGIN_TOP, MOBILE_ITEM_HEIGHT, SIZE_TO_ITEM_HEIGHT} from './constants'; import type {Option, OptionGroup} from './tech-components'; @@ -210,8 +211,7 @@ export const getActiveItem = (listRef: React.RefObject>) => export const activateFirstClickableItem = (listRef: React.RefObject>) => { const items = getListItems(listRef); - const isGroupTitleFirstItem = items[0] && 'label' in items[0]; - listRef?.current?.activateItem(isGroupTitleFirstItem ? 1 : 0, false); + listRef?.current?.activateItem(List.findNextIndex(items, 0, 1), false); }; const isOptionMatchedByFilter = (option: SelectOption, filter: string) => {