From 8234e669f77a3c49655b39c2ebe266c6ad0cc763 Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 23 Apr 2024 18:01:13 +0700 Subject: [PATCH] fix: arrow key focus manager does not ignore disabled item --- src/components/SelectionList/BaseSelectionList.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index f0d22251bc74..cec5e0c12948 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -228,7 +228,8 @@ function BaseSelectionList( // 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: Math.min(flattenedSections.allOptions.length, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * currentPage - 1), + maxIndex: Math.min(flattenedSections.allOptions.length - 1, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * currentPage - 1), + disabledIndexes: flattenedSections.disabledOptionsIndexes, isActive: true, onFocusedIndexChange: (index: number) => { scrollToIndex(index, true);