Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,31 +541,35 @@ function SearchAutocompleteList(
}, [autocompleteQueryValue, onHighlightFirstItem, normalizedReferenceText]);

return (
<SelectionList<OptionData | SearchQueryItem>
showLoadingPlaceholder={!areOptionsInitialized}
fixedNumItemsForLoader={4}
loaderSpeed={CONST.TIMING.SKELETON_ANIMATION_SPEED}
sections={sections}
onSelectRow={onListItemPress}
ListItem={SearchRouterItem}
containerStyle={[styles.mh100]}
sectionListStyle={[styles.ph2, styles.pb2, styles.overscrollBehaviorContain]}
listItemWrapperStyle={[styles.pr0, styles.pl0]}
getItemHeight={getItemHeight}
onLayout={() => {
setPerformanceTimersEnd();
setIsInitialRender(false);
}}
showScrollIndicator={!shouldUseNarrowLayout}
sectionTitleStyles={styles.mhn2}
shouldSingleExecuteRowSelect
onArrowFocus={onArrowFocus}
ref={ref}
initiallyFocusedOptionKey={!shouldUseNarrowLayout ? styledRecentReports.at(0)?.keyForList : undefined}
shouldScrollToFocusedIndex={!isInitialRender}
shouldSubscribeToArrowKeyEvents={shouldSubscribeToArrowKeyEvents}
disableKeyboardShortcuts={!shouldSubscribeToArrowKeyEvents}
/>
// On page refresh, when the list is rendered before options are initialized the auto-focusing on initiallyFocusedOptionKey
// will fail because the list will be empty on first render so we only render after options are initialized.
areOptionsInitialized && (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a unintended side-effect from this condition, which caused keyboard selection to stop working correctly. More details #60709

<SelectionList<OptionData | SearchQueryItem>
showLoadingPlaceholder={!areOptionsInitialized}
fixedNumItemsForLoader={4}
loaderSpeed={CONST.TIMING.SKELETON_ANIMATION_SPEED}
sections={sections}
onSelectRow={onListItemPress}
ListItem={SearchRouterItem}
containerStyle={[styles.mh100]}
sectionListStyle={[styles.ph2, styles.pb2, styles.overscrollBehaviorContain]}
listItemWrapperStyle={[styles.pr0, styles.pl0]}
getItemHeight={getItemHeight}
onLayout={() => {
setPerformanceTimersEnd();
setIsInitialRender(false);
}}
showScrollIndicator={!shouldUseNarrowLayout}
sectionTitleStyles={styles.mhn2}
shouldSingleExecuteRowSelect
onArrowFocus={onArrowFocus}
ref={ref}
initiallyFocusedOptionKey={!shouldUseNarrowLayout ? styledRecentReports.at(0)?.keyForList : undefined}
shouldScrollToFocusedIndex={!isInitialRender}
shouldSubscribeToArrowKeyEvents={shouldSubscribeToArrowKeyEvents}
disableKeyboardShortcuts={!shouldSubscribeToArrowKeyEvents}
/>
)
);
}

Expand Down