components icon indicating copy to clipboard operation
components copied to clipboard

bug(TABLE): cell with mat-cell directive is missing role="cell" attribute

Open miszol1 opened this issue 1 year ago • 2 comments

Is this a regression?

  • [X] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16.2.14

Description

When using mat-table and mat-cell it used to have role="cell" for each cell in the table. Now there is not role attribute in cell elements.

Reproduction

Reproduction link: https://v17.material.angular.io/components/table/examples You can check examples in 'Examples' tab on official docs website. Steps to reproduce:

  1. Inspect any cell in table and you will find that there is no role="cell" attribute.

Previous version with expected behavior: https://v16.material.angular.io/components/table/examples Steps to reproduce:

  1. Inspect any cell in table and you will find that there is role="cell" attribute.

Expected Behavior

Cell has role="cell" attribute.

Actual Behavior

Cell does not have role="cell" attribute.

Environment

  • Angular: 17.3.12
  • CDK/Material: 17.3.10
  • Browser(s): Google Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

miszol1 avatar Sep 24 '24 16:09 miszol1

Confirmed role="cell" appears in v16 but not in v17 and v18.

For documentation this is where the cell role is coming from: https://github.com/angular/components/blob/main/src/cdk/table/table.ts#L467

amysorto avatar Sep 24 '24 20:09 amysorto

I think that's correct for td elements, because the browser already infers them to be cells, and for mat-cell elements we set the role correctly. Here's the accessibility tree showing that the role is inferred as expected: image

crisbeto avatar Sep 27 '24 06:09 crisbeto

What about Safari browser? Chrome is indeed marking td as cell in accessibility tab but Safari is not.

Image

JakubPawlak avatar Oct 17 '24 08:10 JakubPawlak

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.