diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index e9f4ab594c12..2cb6d3dac118 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -129,6 +129,7 @@ function BaseSelectionList( shouldDebounceScrolling = false, shouldPreventActiveCellVirtualization = false, shouldScrollToFocusedIndex = true, + isSmallScreenWidth, onContentSizeChange, listItemTitleStyles, initialNumToRender = 12, @@ -412,6 +413,9 @@ function BaseSelectionList( if (shouldShowTextInput) { clearInputAfterSelect(); + } else if (isSmallScreenWidth) { + onCheckboxPress?.(item); + return; } } @@ -437,6 +441,8 @@ function BaseSelectionList( shouldPreventDefaultFocusOnSelectRow, isFocused, isScreenFocused, + isSmallScreenWidth, + onCheckboxPress, ], ); diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 3d48880c6755..8ce736acfe7d 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -572,6 +572,9 @@ type SelectionListProps = Partial & { /** Whether focus event should be delayed */ shouldDelayFocus?: boolean; + /** Whether the layout is narrow */ + isSmallScreenWidth?: boolean; + /** Callback to fire when the text input changes */ onArrowFocus?: (focusedItem: TItem) => void; diff --git a/src/components/SelectionListWithModal/index.tsx b/src/components/SelectionListWithModal/index.tsx index 29347830268e..65825355d2ea 100644 --- a/src/components/SelectionListWithModal/index.tsx +++ b/src/components/SelectionListWithModal/index.tsx @@ -106,6 +106,7 @@ function SelectionListWithModal( sections={sections} onLongPressRow={handleLongPressRow} isScreenFocused={isScreenFocused} + isSmallScreenWidth={isSmallScreenWidth} // eslint-disable-next-line react/jsx-props-no-spreading {...rest} />