Skip to content

Commit

Permalink
Fix multi select initial anchor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Aug 21, 2024
1 parent 9a888c2 commit 5fa5fba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/src/lib/components/Select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const Select = withDefaults<SelectProps>()(defaultProps, (props) => {
if (props.value && !isEqual(props.value, prevPropsValue)) {
setSelectedOptionValues([...props.value]);
setPrevPropsValue([...props.value]);
setSelectionAnchor(filteredOptions.findIndex((option) => option.value === props.value[0]));
}

const handleOnChange = React.useCallback(
Expand Down Expand Up @@ -344,6 +345,7 @@ export const Select = withDefaults<SelectProps>()(defaultProps, (props) => {

setCurrentFocusIndex(newCurrentKeyboardFocusIndex);
setVirtualizationStartIndex(newVirtualizationStartIndex);
setSelectionAnchor(newFilteredOptions.findIndex((option) => option.value === selectedOptionValues[0]));
}

function handleFilterChange(event: React.ChangeEvent<HTMLInputElement>) {
Expand Down

0 comments on commit 5fa5fba

Please sign in to comment.