@@ -61,7 +61,7 @@ const navigateFromActiveSubCompItem = (currentlyFocusedCell, e) => {
61
61
setFocus ( currentlyFocusedCell , recursiveSubComponentElementSearch ( e . target ) ) ;
62
62
} ;
63
63
64
- const useGetTableProps = ( tableProps , { instance : { webComponentsReactProperties, data, columns } } ) => {
64
+ const useGetTableProps = ( tableProps , { instance : { webComponentsReactProperties, data, columns, state } } ) => {
65
65
const { showOverlay, tableRef } = webComponentsReactProperties ;
66
66
const currentlyFocusedCell = useRef < HTMLDivElement > ( null ) ;
67
67
const noData = data . length === 0 ;
@@ -143,6 +143,7 @@ const useGetTableProps = (tableProps, { instance: { webComponentsReactProperties
143
143
144
144
const onKeyboardNavigation = useCallback (
145
145
( e ) => {
146
+ const { isRtl } = state ;
146
147
const isActiveItemInSubComponent = e . target . dataset . subcomponentActiveElement ;
147
148
// check if target is cell and if so proceed from there
148
149
if (
@@ -228,7 +229,7 @@ const useGetTableProps = (tableProps, { instance: { webComponentsReactProperties
228
229
return ;
229
230
}
230
231
const newElement = tableRef . current . querySelector (
231
- `div[data-column-index="${ columnIndex + 1 } "][data-row-index="${ rowIndex } "]`
232
+ `div[data-column-index="${ columnIndex + ( isRtl ? - 1 : 1 ) } "][data-row-index="${ rowIndex } "]`
232
233
) ;
233
234
if ( newElement ) {
234
235
setFocus ( currentlyFocusedCell , newElement ) ;
@@ -244,7 +245,7 @@ const useGetTableProps = (tableProps, { instance: { webComponentsReactProperties
244
245
return ;
245
246
}
246
247
const newElement = tableRef . current . querySelector (
247
- `div[data-column-index="${ columnIndex - 1 } "][data-row-index="${ rowIndex } "]`
248
+ `div[data-column-index="${ columnIndex - ( isRtl ? - 1 : 1 ) } "][data-row-index="${ rowIndex } "]`
248
249
) ;
249
250
if ( newElement ) {
250
251
setFocus ( currentlyFocusedCell , newElement ) ;
@@ -309,7 +310,7 @@ const useGetTableProps = (tableProps, { instance: { webComponentsReactProperties
309
310
}
310
311
}
311
312
} ,
312
- [ currentlyFocusedCell . current , tableRef . current ]
313
+ [ currentlyFocusedCell . current , tableRef . current , state ?. isRtl ]
313
314
) ;
314
315
if ( showOverlay ) {
315
316
return tableProps ;
0 commit comments