Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent default scrolling behavior in selection list #54797

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function BaseSelectionList<TItem extends ListItem>(
initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
maxIndex: Math.min(flattenedSections.allOptions.length - 1, CONST.MAX_SELECTION_LIST_PAGE_LENGTH * currentPage - 1),
disabledIndexes: disabledArrowKeyIndexes,
isActive: isFocused,
isActive: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Coming from: #55734, isActive should be assigned to isFocused

onFocusedIndexChange: (index: number) => {
const focusedItem = flattenedSections.allOptions.at(index);
if (focusedItem) {
Expand Down
8 changes: 8 additions & 0 deletions src/stories/SelectionList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const SelectionListWithNavigation = withNavigationFallback(SelectionList);
const story: Meta<typeof SelectionList> = {
title: 'Components/SelectionList',
component: SelectionList,
parameters: {
docs: {
source: {
type: 'code',
},
},
},
};

const SECTIONS = [
Expand Down Expand Up @@ -417,6 +424,7 @@ WithConfirmButton.args = {
...MultipleSelection.args,
onConfirm: () => {},
confirmButtonText: 'Confirm',
showConfirmButton: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this change relevant to the changes that we have done for isActive?

Copy link
Contributor Author

@QichenZhu QichenZhu Jan 7, 2025

Choose a reason for hiding this comment

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

This is not relevant, but the story was broken, so I fixed it as required by the checklist.

};

export {Default, WithTextInput, WithHeaderMessage, WithAlternateText, MultipleSelection, WithSectionHeader, WithConfirmButton};
Expand Down
Loading