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: a11y-SR row count announcement in DataTable with expandable rows #18457

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

2nikhiltom
Copy link
Contributor

Closes #16813

Screen reader incorrectly counts expandable content as rows. For a table with 1 header row and 6 data rows (total 7 rows), it announces additional rows by including the hidden expandable content.

Quick Question

Current fix uses aria-labels in storybook examples, but baking it into the component with a new prop like a rowCount would make it more semantic (uses proper aria-rowcount) and it will be part of component's accessibility

Changelog

New

added aria-expanded and aria-hidden to correctly announce 7 rows

Testing / Reviewing

open deploy preview and visit datatable with expandable row variants and verify correct no of rows and column are announced for the Table

@2nikhiltom 2nikhiltom requested a review from a team as a code owner January 28, 2025 15:16
Copy link

netlify bot commented Jan 28, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit 6a23b0e
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/679a1e664803050008804f7e
😎 Deploy Preview https://deploy-preview-18457--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 28, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 6a23b0e
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/679a1e66ac1fe80008873763
😎 Deploy Preview https://deploy-preview-18457--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 28, 2025

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit 6a23b0e
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/679a1e662e94a00008efe4be
😎 Deploy Preview https://deploy-preview-18457--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.16%. Comparing base (5a0348c) to head (2ddc841).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18457   +/-   ##
=======================================
  Coverage   84.16%   84.16%           
=======================================
  Files         408      408           
  Lines       14449    14449           
  Branches     4696     4666   -30     
=======================================
  Hits        12161    12161           
+ Misses       2124     2123    -1     
- Partials      164      165    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kennylam
Copy link
Member

Adding it to the stories only solves it for the examples, but not for adopters unless they apply the same fixes on their end. Also I think using aria-rowcount would still announce the hidden rows since its purpose is to announce total rows in a table regardless of what is visible?

Maybe the best solution is to add the ARIA attributes to the components directly like you mentioned?

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