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

fix(Accessability): Add button role to table header interactive element #347

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

StoianLucian
Copy link
Contributor

Ticket: SITES-10962

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@Pareesh
Copy link
Collaborator

Pareesh commented Apr 24, 2024

Hi @StoianLucian ,
I think the 'th' element of table should have aria-sort and role as "columnheader".

The coral-table-headercell-content should be role button, I guess that would correct the accessibility.

Since the impact of this change is quite large spread, please add a null check to avoid same regression in future.

Thank you

@majornista
Copy link
Collaborator

Hello @Pareesh even if i target the coral-table-headercell-content i still get the same test fails regarding aria sort attribute and surely removing the aria-sort attribute is not a good ideea And according to https://www.digitala11y.com/columnheader-role/ role columnheader the supported properties are

image

Could it be maybe the requirement of the ticket is not correct?

image

There seem to be some strange choices going on when the table header is sticky, like adding role="presentation" to the th[is="coral-table-headercell"] and moving role="columnheader" to the coral-table-headercell-content, which is in part why you are seeing axe error when you then set role="button" on coral-table-headercell-content, which overrides the role="columnheader".

@StoianLucian and @Pareesh, do you mind if I commit some suggested changes to this PR?

@StoianLucian
Copy link
Contributor Author

hello @majornista, Please do!

- Column header cells should always have role="columnheader".
- Sortable cell content should have role="button" and tabindex="0".
- Sortable column header cells should have aria-sort attribute, regardless of whether or not the table header row is sticky.
@Pareesh
Copy link
Collaborator

Pareesh commented May 7, 2024

Hi @majornista @StoianLucian ,
Are these changes done ??

Thank you

@StoianLucian
Copy link
Contributor Author

Hi @Pareesh the changes are done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants