Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-compact-interactive list] Fix to put focus on first item only on initial render #2125

Merged
merged 2 commits into from
Apr 8, 2024
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
5 changes: 4 additions & 1 deletion packages/terra-compact-interactive-list/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Changed to avoid focus being set to the first cell on multiple re-renders.

## 1.15.0 - (April 4, 2024)

* Changed
Expand Down Expand Up @@ -122,4 +125,4 @@

## 1.0.0-alpha.1 - (November 22, 2023)

* Initial package release.
* Initial package release.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ const CompactInteractiveList = (props) => {
if (listRef?.current && focusedCell?.current) {
focusedCell.current = getFocusedCellIds(listRef?.current, columns, { row: 0, cell: 0 });
}
}, [listRef, focusedCell, columns]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const focusCell = ({ row, cell }) => {
// add 1 to the row number to accommodate for hidden header
Expand Down
Loading