fix(datatable): improve sortable header accessibility - #4345
Conversation
Co-authored-by: Codex <codex@openai.com>
✅ Deploy Preview for paragon-openedx-v23 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks for the pull request, @edschema! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-23.x #4345 +/- ##
================================================
- Coverage 94.40% 94.26% -0.14%
================================================
Files 242 242
Lines 4309 4309
Branches 981 1038 +57
================================================
- Hits 4068 4062 -6
- Misses 237 238 +1
- Partials 4 9 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
This PR improves DataTable sortable header accessibility.
Keyboard operation; Sortable headers now render a native button inside the existing
<th>, with React Table sort toggle props on the button. This makes sortable headers reachable with Tab and operable with Enter and Space.Sort state: Sorted headers now expose sort direction with
aria-sorton the primary sorted header only. Inactive sortable headers and secondary multi-sort headers omitaria-sort.Column scope declaration: DataTable header cells also render
scope="col", and scoped DataTable styles keep the sort button aligned with the existing header layout and click target.Out of Scope
Change Log
<th>to the sort button.aria-sortfor the primary sorted column and omit it for inactive or secondary sorted columns.scope="col"to DataTable header cells.aria-sortbehavior.Notes
aria-sort.keyspread warning is existing behavior from React Table prop getters and is unchanged by this PR.Tests Done
npm test -- --runTestsByPath src/DataTable/tests/DataTable.test.jsx src/DataTable/tests/TableHeaderCell.test.jsx --coverage=falsegit diff --checkDeploy Preview
https://deploy-preview-4345--paragon-openedx-v23.netlify.app/components/datatable/#frontend-filtering-and-sorting
Merge Checklist
pgn__DataTable classes under the existing.pgn__data-tablestyles.exampleapp?TableHeaderCelltests and DataTable regression tests cover the changed behavior.Post-merge Checklist
AI Assistance
AI tools were used to aid in diagnosis, planning, implementation, and review. All work was checked and reviewed.