Merge pull request #17345 from desktop/fix-tab-flat-list

Fix tab behavior on flat lists with no selected item
This commit is contained in:
Sergio Padrino 2023-09-05 19:32:11 +02:00 committed by GitHub
commit 2fef5ba055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -651,6 +651,11 @@ export class List extends React.Component<IListProps, IListState> {
// focused list item if it scrolls back into view.
if (!focusWithin) {
this.focusRow = -1
} else if (this.props.selectedRows.length === 0) {
const firstSelectableRowIndexPath = this.getFirstSelectableRowIndexPath()
if (firstSelectableRowIndexPath !== null) {
this.moveSelectionTo(firstSelectableRowIndexPath, { kind: 'focus' })
}
}
}