Skip to content

Commit

Permalink
fix(Select): keyboard behavior on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
iapolya committed Jan 31, 2025
1 parent 4aec513 commit b830b18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(function

if (multiple) {
const activeItemIndex = listRef?.current?.getActiveItem();
filterRef.current?.focus();

if (!mobile) {
filterRef.current?.focus();
}

if (typeof activeItemIndex === 'number') {
// prevent item deactivation in case of multiple selection
Expand All @@ -178,7 +181,7 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(function

handleSelection(option);
},
[handleSelection, multiple],
[handleSelection, mobile, multiple],
);

const handleControlKeyDown = React.useCallback(
Expand Down Expand Up @@ -249,6 +252,7 @@ export const Select = React.forwardRef<HTMLButtonElement, SelectProps>(function
},
[handleClose, onBlur],
),
isDisabled: mobile,
});

const uniqId = useUniqId();
Expand Down

0 comments on commit b830b18

Please sign in to comment.