Skip to content

Commit

Permalink
update comment.
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Gupta <[email protected]>
  • Loading branch information
Krishna2323 committed Jun 25, 2024
1 parent 01d8742 commit 2650038
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ function BaseSelectionList<TItem extends ListItem>(
if ((prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || flattenedSections.allOptions.length === 0) {
return;
}
// Remove the focus if the search input is empty or selected options length is changed else focus on the first non disabled item
// Remove the focus if the search input is empty or selected options length is changed (and allOptions length remains the same)
// else focus on the first non disabled item
const newSelectedIndex =
textInputValue === '' || (flattenedSections.selectedOptions.length !== prevSelectedOptionsLength && prevAllOptionsLength === flattenedSections.allOptions.length) ? -1 : 0;

Expand Down

0 comments on commit 2650038

Please sign in to comment.