Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
miszol1 opened this issue Sep 24, 2024 · 2 comments
Open
1 task done
Labels
Accessibility This issue is related to accessibility (a11y) area: cdk/table P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@miszol1
Copy link

miszol1 commented Sep 24, 2024

Is this a regression?

  • 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 miszol1 added the needs triage This issue needs to be triaged by the team label Sep 24, 2024
@amysorto
Copy link
Contributor

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 amysorto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) area: cdk/table and removed needs triage This issue needs to be triaged by the team labels Sep 24, 2024
@crisbeto
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility This issue is related to accessibility (a11y) area: cdk/table P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants