Skip to content

Commit 944729b

Browse files
authored
fix(AnalyticalTable): replace role cell with gridcell (#5080)
Fixes #5074
1 parent 84eef5c commit 944729b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/main/src/components/AnalyticalTable/AnalyticalTable.cy.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,19 +559,19 @@ describe('AnalyticalTable', () => {
559559
cy.mount(<TestComponent />);
560560

561561
cy.findAllByRole('columnheader').invoke('outerHeight').should('equal', 44);
562-
cy.findAllByRole('cell').invoke('outerHeight').should('equal', 44);
562+
cy.findAllByRole('gridcell').invoke('outerHeight').should('equal', 44);
563563

564564
cy.findByTestId('rowHeight').typeIntoUi5Input('100');
565565
cy.findAllByRole('columnheader').invoke('outerHeight').should('equal', 100);
566-
cy.findAllByRole('cell').invoke('outerHeight').should('equal', 100);
566+
cy.findAllByRole('gridcell').invoke('outerHeight').should('equal', 100);
567567

568568
cy.findByTestId('headerRowHeight').typeIntoUi5Input('200');
569569
cy.findAllByRole('columnheader').invoke('outerHeight').should('equal', 200);
570-
cy.findAllByRole('cell').invoke('outerHeight').should('equal', 100);
570+
cy.findAllByRole('gridcell').invoke('outerHeight').should('equal', 100);
571571

572572
cy.findByTestId('headerRowHeight').typeIntoUi5Input('{selectall}{backspace}');
573573
cy.findAllByRole('columnheader').invoke('outerHeight').should('equal', 100);
574-
cy.findAllByRole('cell').invoke('outerHeight').should('equal', 100);
574+
cy.findAllByRole('gridcell').invoke('outerHeight').should('equal', 100);
575575
});
576576

577577
it('GroupBy selection', () => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ interface UpdatedCellProptypes {
66
'aria-expanded'?: string | boolean;
77
'aria-label'?: string;
88
'aria-colindex'?: number;
9+
role?: string;
910
}
1011

1112
const setCellProps = (cellProps, { cell, instance }) => {
1213
const { column, row, value } = cell;
1314
const columnIndex = instance.visibleColumns.findIndex(({ id }) => id === column.id);
1415
const { alwaysShowSubComponent, renderRowSubComponent, translatableTexts, selectionMode, selectionBehavior } =
1516
instance.webComponentsReactProperties;
16-
const updatedCellProps: UpdatedCellProptypes = { 'aria-colindex': columnIndex + 1 }; // aria index is 1 based, not 0
17+
const updatedCellProps: UpdatedCellProptypes = { 'aria-colindex': columnIndex + 1, role: 'gridcell' }; // aria index is 1 based, not 0
1718

1819
const RowSubComponent = typeof renderRowSubComponent === 'function' ? renderRowSubComponent(row) : undefined;
1920
const rowIsExpandable = row.canExpand || (RowSubComponent && !alwaysShowSubComponent);

0 commit comments

Comments
 (0)