Skip to content

Commit

Permalink
fix(select): connect combobox to listbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS committed Jun 18, 2024
1 parent 38fe431 commit 8cf1106
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class List<T = unknown> extends React.Component<ListProps<T>, ListState<T

render() {
const {
id,
emptyPlaceholder,
virtualized,
className,
Expand All @@ -158,6 +159,7 @@ export class List<T = unknown> extends React.Component<ListProps<T>, ListState<T
>
{this.renderFilter()}
<div
id={id}
className={b('items', {virtualized}, itemsClassName)}
style={this.getItemsStyle()}
onMouseLeave={this.onMouseLeave}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(function
getOptionGroupHeight={getOptionGroupHeight}
loading={props.loading}
onLoadMore={props.onLoadMore}
selectId={selectId}
id={popupId}
onChangeActive={setActiveIndex}
/>
);
Expand Down Expand Up @@ -368,7 +368,6 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(function
disablePortal={disablePortal}
virtualized={virtualized}
mobile={mobile}
id={popupId}
placement={popupPlacement}
>
{renderPopup({renderFilter: _renderFilter, renderList: _renderList})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ export const SelectControl = React.forwardRef<HTMLButtonElement, ControlProps>((
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}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Select/components/SelectList/SelectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type SelectListProps = {
virtualized?: boolean;
loading?: boolean;
onLoadMore?: () => void;
selectId: string;
id: string;
onChangeActive: (index?: number) => void;
};

Expand All @@ -49,7 +49,7 @@ export const SelectList = React.forwardRef<List<FlattenOption>, SelectListProps>
mobile,
loading,
onLoadMore,
selectId,
id,
onChangeActive,
} = props;
const items = React.useMemo(
Expand Down Expand Up @@ -145,7 +145,7 @@ export const SelectList = React.forwardRef<List<FlattenOption>, SelectListProps>
renderItem={renderItem}
onItemClick={onOptionClick}
selectedItemIndex={selectedIndexes}
id={`${selectId}-list`}
id={id}
role="listbox"
onChangeActive={onChangeActive}
/>
Expand Down

0 comments on commit 8cf1106

Please sign in to comment.