Fix tab behavior on flat lists with no selected item

This commit is contained in:
Sergio Padrino 2023-09-05 18:26:03 +02:00
parent 982b37fc13
commit c7b9a62a41

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' })
}
}
}