Skip to content

Commit

Permalink
current page on search value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemorawski committed Mar 12, 2024
1 parent aad3855 commit 1ba195b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ function BaseSelectionList<TItem extends ListItem>(
}
// Remove the focus if the search input is empty else focus on the first non disabled item
const newSelectedIndex = textInputValue === '' ? -1 : 0;
// reseting the currrent page to 1 when the user types something
setCurrentPage(1);

updateAndScrollToFocusedIndex(newSelectedIndex);
}, [canSelectMultiple, flattenedSections.allOptions.length, prevTextInputValue, textInputValue, updateAndScrollToFocusedIndex]);
Expand Down

0 comments on commit 1ba195b

Please sign in to comment.