From cad818edca55fe06bf4e438a3df16b955555b7fb Mon Sep 17 00:00:00 2001 From: Aleksandra Danilina Date: Tue, 1 Aug 2023 09:52:15 +0200 Subject: [PATCH] chore: Rebase --- src/table/internal.tsx | 8 ++++++-- src/table/table-role/table-role-helper.ts | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/table/internal.tsx b/src/table/internal.tsx index eb39805877..da2ef60030 100644 --- a/src/table/internal.tsx +++ b/src/table/internal.tsx @@ -317,8 +317,12 @@ const InternalTable = React.forwardRef( resizableColumns && styles['table-layout-fixed'], contentDensity === 'compact' && getVisualContextClassname('compact-table') )} - aria-labelledby={isLabelledByHeader ? headingId : undefined} - {...getTableRoleProps({ tableRole, totalItemsCount, ariaLabel: ariaLabels?.tableLabel })} + {...getTableRoleProps({ + tableRole, + totalItemsCount, + ariaLabel: ariaLabels?.tableLabel, + ariaLabelledBy: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined, + })} > { const nativeProps: React.TableHTMLAttributes = {}; @@ -28,6 +29,7 @@ export function getTableRoleProps(options: { nativeProps.role = options.tableRole; nativeProps['aria-label'] = options.ariaLabel; + nativeProps['aria-labelledby'] = options.ariaLabelledBy; // Incrementing the total count by one to account for the header row. nativeProps['aria-rowcount'] = options.totalItemsCount ? options.totalItemsCount + 1 : -1;