From 48a3dae58c0e966fa25367a832d72f6d887001da Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Tue, 13 Aug 2024 22:50:48 +0700 Subject: [PATCH] resolve the highlight bug --- src/components/SelectionList/BaseSelectionList.tsx | 7 ++++++- .../NetSuiteCustomFieldMappingPicker.tsx | 2 ++ .../substeps/ChooseSegmentTypeStep.tsx | 2 ++ .../expensifyCard/WorkspaceEditCardLimitTypePage.tsx | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index e78d3d43d1ec..3b9106a8baed 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -538,7 +538,11 @@ function BaseSelectionList( useEffect(() => { // Avoid changing focus if the textInputValue remains unchanged. - if ((prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || flattenedSections.allOptions.length === 0) { + if ( + (prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || + flattenedSections.allOptions.length === 0 || + shouldUpdateFocusedIndex + ) { return; } // Remove the focus if the search input is empty or selected options length is changed (and allOptions length remains the same) @@ -559,6 +563,7 @@ function BaseSelectionList( updateAndScrollToFocusedIndex, prevSelectedOptionsLength, prevAllOptionsLength, + shouldUpdateFocusedIndex, ]); useEffect( diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomFieldMappingPicker.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomFieldMappingPicker.tsx index 416633699d86..b98b8b328b77 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomFieldMappingPicker.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/NetSuiteCustomFieldMappingPicker.tsx @@ -42,6 +42,8 @@ function NetSuiteCustomFieldMappingPicker({value, errorText, onInputChange}: Net }} ListItem={RadioListItem} initiallyFocusedOptionKey={value ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG} + shouldSingleExecuteRowSelect + shouldUpdateFocusedIndex /> {!!errorText && ( diff --git a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/substeps/ChooseSegmentTypeStep.tsx b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/substeps/ChooseSegmentTypeStep.tsx index 9fd92204c31e..a5bbb15a1756 100644 --- a/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/substeps/ChooseSegmentTypeStep.tsx +++ b/src/pages/workspace/accounting/netsuite/import/NetSuiteImportCustomFieldNew/substeps/ChooseSegmentTypeStep.tsx @@ -53,6 +53,8 @@ function ChooseSegmentTypeStep({onNext, customSegmentType, setCustomSegmentType} setSelectedType(selected.value); setIsError(false); }} + shouldSingleExecuteRowSelect + shouldUpdateFocusedIndex showConfirmButton confirmButtonText={translate('common.next')} onConfirm={onConfirm} diff --git a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx index 60435cef62f5..441e2e80006b 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceEditCardLimitTypePage.tsx @@ -118,6 +118,7 @@ function WorkspaceEditCardLimitTypePage({route}: WorkspaceEditCardLimitTypePageP onSelectRow={({value}) => setTypeSelected(value)} sections={[{data}]} shouldUpdateFocusedIndex + shouldSingleExecuteRowSelect isAlternateTextMultilineSupported initiallyFocusedOptionKey={typeSelected} />