Skip to content

Commit

Permalink
TreeGrid: Fix child row Left Arrow not finding parent row. (#38639)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstine committed Feb 9, 2022
1 parent 4f72f26 commit fe8707b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/components/src/tree-grid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ function TreeGrid(
}
// If a row is focused, and it is collapsed, moves to the parent row (if there is one).
const level = Math.max(
parseInt( activeRow?.ariaLevel ?? 1, 10 ) - 1,
parseInt(
activeRow?.getAttribute( 'aria-level' ) ?? 1,
10
) - 1,
1
);
const rows = Array.from(
Expand All @@ -120,7 +123,10 @@ function TreeGrid(
const currentRowIndex = rows.indexOf( activeRow );
for ( let i = currentRowIndex; i >= 0; i-- ) {
if (
parseInt( rows[ i ].ariaLevel, 10 ) === level
parseInt(
rows[ i ].getAttribute( 'aria-level' ),
10
) === level
) {
parentRow = rows[ i ];
break;
Expand Down

0 comments on commit fe8707b

Please sign in to comment.