Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(select): connect combobox to listbox #1665

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
};

refFilter = React.createRef<HTMLInputElement>();
refContainer = React.createRef<any>();

Check warning on line 102 in src/components/List/List.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected any. Specify a different type
blurTimer: ReturnType<typeof setTimeout> | null = null;
loadingItem = {value: '__LIST_ITEM_LOADING__', disabled: false} as unknown as ListItemData<
T & {value: string}
Expand Down Expand Up @@ -133,6 +133,7 @@

render() {
const {
id,
emptyPlaceholder,
virtualized,
className,
Expand All @@ -158,6 +159,7 @@
>
{this.renderFilter()}
<div
id={id}
className={b('items', {virtualized}, itemsClassName)}
style={this.getItemsStyle()}
onMouseLeave={this.onMouseLeave}
Expand Down Expand Up @@ -217,11 +219,11 @@
break;
}
case 'PageDown': {
this.handleKeyMove(event, pageSize!);

Check warning on line 222 in src/components/List/List.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Forbidden non-null assertion
break;
}
case 'PageUp': {
this.handleKeyMove(event, -pageSize!);

Check warning on line 226 in src/components/List/List.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Forbidden non-null assertion
break;
}
case 'Home': {
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
Loading