@@ -291,7 +291,11 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
291
291
< TableRowGroup
292
292
key = { reusableView . key }
293
293
layoutInfo = { reusableView . layoutInfo }
294
- parent = { parent ?. layoutInfo } >
294
+ parent = { parent ?. layoutInfo }
295
+ // Override the default role="rowgroup" with role="presentation",
296
+ // in favor or adding role="rowgroup" to the ScrollView with
297
+ // ref={bodyRef} in the TableVirtualizer below.
298
+ role = "presentation" >
295
299
{ renderChildren ( children ) }
296
300
</ TableRowGroup >
297
301
) ;
@@ -332,7 +336,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
332
336
</ TableHeaderRow >
333
337
) ;
334
338
}
335
-
339
+
336
340
return (
337
341
< TableCellWrapper
338
342
key = { reusableView . key }
@@ -448,7 +452,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
448
452
) ;
449
453
450
454
return (
451
- < TableContext . Provider
455
+ < TableContext . Provider
452
456
value = { {
453
457
state,
454
458
dragState,
@@ -491,7 +495,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
491
495
styleProps . className
492
496
)
493
497
}
494
- // This should be `tableLayout` rather than `layout` so it doesn't
498
+ // This should be `tableLayout` rather than `layout` so it doesn't
495
499
// change objects and invalidate virtualizer.
496
500
layout = { tableLayout }
497
501
collection = { state . collection }
@@ -617,7 +621,6 @@ function TableVirtualizer(props) {
617
621
{ state . visibleViews [ 0 ] }
618
622
</ div >
619
623
< ScrollView
620
- role = "presentation"
621
624
className = {
622
625
classNames (
623
626
styles ,
@@ -635,6 +638,11 @@ function TableVirtualizer(props) {
635
638
)
636
639
)
637
640
}
641
+ // Firefox and Chrome make generic elements using CSS overflow 'scroll' or 'auto' tabbable,
642
+ // including them within the accessibility tree, which breaks the table structure in Firefox.
643
+ // Using tabIndex={-1} prevents the ScrollView from being tabbable, and using role="rowgroup"
644
+ // here and role="presentation" on the table body content fixes the table structure.
645
+ role = "rowgroup"
638
646
tabIndex = { isVirtualDragging ? null : - 1 }
639
647
style = { {
640
648
flex : 1 ,
0 commit comments