From 8cf11067189bf642ae6a19fd46c1d7a1bffc2b09 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Wed, 19 Jun 2024 01:00:26 +0200 Subject: [PATCH] fix(select): connect combobox to listbox --- src/components/List/List.tsx | 2 ++ src/components/Select/Select.tsx | 3 +-- .../Select/components/SelectControl/SelectControl.tsx | 4 +--- src/components/Select/components/SelectList/SelectList.tsx | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index 32e18fb0cb..6c87afce04 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -133,6 +133,7 @@ export class List extends React.Component, ListState extends React.Component, ListState {this.renderFilter()}
(function getOptionGroupHeight={getOptionGroupHeight} loading={props.loading} onLoadMore={props.onLoadMore} - selectId={selectId} + id={popupId} onChangeActive={setActiveIndex} /> ); @@ -368,7 +368,6 @@ export const Select = React.forwardRef(function disablePortal={disablePortal} virtualized={virtualized} mobile={mobile} - id={popupId} placement={popupPlacement} > {renderPopup({renderFilter: _renderFilter, renderList: _renderList})} diff --git a/src/components/Select/components/SelectControl/SelectControl.tsx b/src/components/Select/components/SelectControl/SelectControl.tsx index 53cd24f3b7..d7e0f5248e 100644 --- a/src/components/Select/components/SelectControl/SelectControl.tsx +++ b/src/components/Select/components/SelectControl/SelectControl.tsx @@ -181,9 +181,7 @@ export const SelectControl = React.forwardRef(( aria-haspopup="listbox" aria-expanded={open} aria-activedescendant={ - activeIndex === undefined - ? undefined - : `${selectId}-list-item-${activeIndex}` + activeIndex === undefined ? undefined : `${popupId}-item-${activeIndex}` } disabled={disabled} onClick={handleControlClick} diff --git a/src/components/Select/components/SelectList/SelectList.tsx b/src/components/Select/components/SelectList/SelectList.tsx index b98dfc8108..652aa81c79 100644 --- a/src/components/Select/components/SelectList/SelectList.tsx +++ b/src/components/Select/components/SelectList/SelectList.tsx @@ -28,7 +28,7 @@ type SelectListProps = { virtualized?: boolean; loading?: boolean; onLoadMore?: () => void; - selectId: string; + id: string; onChangeActive: (index?: number) => void; }; @@ -49,7 +49,7 @@ export const SelectList = React.forwardRef, SelectListProps> mobile, loading, onLoadMore, - selectId, + id, onChangeActive, } = props; const items = React.useMemo( @@ -145,7 +145,7 @@ export const SelectList = React.forwardRef, SelectListProps> renderItem={renderItem} onItemClick={onOptionClick} selectedItemIndex={selectedIndexes} - id={`${selectId}-list`} + id={id} role="listbox" onChangeActive={onChangeActive} />