From 113d1397be1626d2400af7959f957640a7385504 Mon Sep 17 00:00:00 2001 From: Alex Stine Date: Tue, 8 Feb 2022 15:49:17 -0500 Subject: [PATCH] Fix child row Left Arrow not finding parent row. --- packages/components/src/tree-grid/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/components/src/tree-grid/index.js b/packages/components/src/tree-grid/index.js index a04c6c266d9bd2..ace70fbdc96dc6 100644 --- a/packages/components/src/tree-grid/index.js +++ b/packages/components/src/tree-grid/index.js @@ -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( @@ -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;