Skip to content

Commit

Permalink
Merge pull request Expensify#40439 from software-mansion-labs/fix/scr…
Browse files Browse the repository at this point in the history
…oll-to-last-index-with-keyboard

Fix scrolling to last index in SelectionList using keyboard
  • Loading branch information
roryabraham authored Apr 18, 2024
2 parents 6c73169 + 838c5f3 commit 985591f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function BaseSelectionList<TItem extends ListItem>(
// If `initiallyFocusedOptionKey` is not passed, we fall back to `-1`, to avoid showing the highlight on the first member
const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({
initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
maxIndex: flattenedSections.allOptions.length - 1,
maxIndex: Math.min(flattenedSections.allOptions.length, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * currentPage - 1),
isActive: true,
onFocusedIndexChange: (index: number) => {
scrollToIndex(index, true);
Expand Down

0 comments on commit 985591f

Please sign in to comment.