Skip to content

Commit 900ca62

Browse files
committed
add aria-rowindex to header row
1 parent cabbc57 commit 900ca62

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/main/src/components/AnalyticalTable/TableBody/VirtualTableBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const VirtualTableBody = (props: VirtualTableBodyProps) => {
152152
}
153153
prepareRow(row);
154154
const { key, ...rowProps } = row.getRowProps({
155-
'aria-rowindex': virtualRow.index + 1,
155+
'aria-rowindex': virtualRow.index + 2,
156156
'data-virtual-row-index': virtualRow.index,
157157
});
158158
const isNavigatedCell = typeof markNavigatedRow === 'function' ? markNavigatedRow(row) : false;

packages/main/src/components/AnalyticalTable/hooks/useA11y.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,29 @@ const setHeaderProps = (
121121
}
122122

123123
if (column.id === '__ui5wcr__internal_selection_column') {
124-
updatedProps['aria-label'] += translatableTexts.selectionHeaderCellText;
124+
updatedProps['aria-label'] += ' ' + translatableTexts.selectionHeaderCellText;
125125
}
126126

127127
if (column.id === '__ui5wcr__internal_highlight_column') {
128-
updatedProps['aria-label'] += translatableTexts.highlightHeaderCellText;
128+
updatedProps['aria-label'] += ' ' + translatableTexts.highlightHeaderCellText;
129129
}
130130

131131
if (column.id === '__ui5wcr__internal_navigation_column') {
132-
updatedProps['aria-label'] += translatableTexts.navigationHeaderCellText;
132+
updatedProps['aria-label'] += ' ' + translatableTexts.navigationHeaderCellText;
133133
}
134134

135135
updatedProps['aria-label'] ||= undefined;
136136

137137
return [headerProps, { isFiltered, ...updatedProps }];
138138
};
139139

140+
const setHeaderGroupProps = (props) => {
141+
return [props, { 'aria-rowindex': 1 }];
142+
};
143+
140144
export const useA11y = (hooks: ReactTableHooks) => {
141145
hooks.getCellProps.push(setCellProps);
142146
hooks.getHeaderProps.push(setHeaderProps);
147+
hooks.getHeaderGroupProps.push(setHeaderGroupProps);
143148
};
144149
useA11y.pluginName = 'useA11y';

0 commit comments

Comments
 (0)