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

Closed
1 task done
miszol1 opened this issue Sep 24, 2024 · 4 comments · Fixed by #29987
Closed
1 task done

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

miszol1 opened this issue Sep 24, 2024 · 4 comments · Fixed by #29987
Assignees
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

@JakubPawlak
Copy link

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

Image

@crisbeto crisbeto self-assigned this Nov 8, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 8, 2024
We were omitting `role="cell"` on native `td` elements, because the browser should be setting it implicitly, but based on the discussion in angular#29784, it seems like Safari doesn't do it. These changes switch to always setting the `role`.

Fixes angular#29784.
crisbeto added a commit that referenced this issue Nov 11, 2024
We were omitting `role="cell"` on native `td` elements, because the browser should be setting it implicitly, but based on the discussion in #29784, it seems like Safari doesn't do it. These changes switch to always setting the `role`.

Fixes #29784.

(cherry picked from commit 80fdf19)
crisbeto added a commit that referenced this issue Nov 11, 2024
We were omitting `role="cell"` on native `td` elements, because the browser should be setting it implicitly, but based on the discussion in #29784, it seems like Safari doesn't do it. These changes switch to always setting the `role`.

Fixes #29784.

(cherry picked from commit 80fdf19)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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

Successfully merging a pull request may close this issue.

4 participants