icflorescu / icflorescu/mantine-datatable

Sortable header cells: localizable sort labels and Space activation

Open
#844 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Version: mantine-datatable 9.2.2

Two small accessibility gaps in the sortable header cell (DataTableHeaderCell):

  1. The sort state is announced in English only. The icon wrapper carries aria-label="Not sorted" / "Sorted ascending" / "Sorted descending". There is no prop to change these strings, unlike noRecordsText, loadingText or recordsPerPageLabel. sortIcons replaces the icon but keeps the English label around it. For a non-English UI, screen reader users hear a mix of languages.

  2. Space does not activate the header. The cell is rendered with role="button" and tabIndex={0}, but onKeyDown only handles Enter. Space is the other standard activation key for buttons; pressing it does nothing and scrolls the page.

Suggested API

  • A sortLabels prop (or similar) with { unsorted, ascending, descending } strings, defaulting to the current English ones.
  • Handle ' ' alongside 'Enter' in the header cell's onKeyDown, with preventDefault() so the page does not scroll.
  • Optionally, aria-sort on the <th>; note that with role="button" on the cell the columnheader role is overridden, so this may need the button role moved to an inner element.

Happy to open a PR if the shape is acceptable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the DataTableHeaderCell implementation and trace how its sortable icon labels and onKeyDown handler are wired. Add configurable unsorted, ascending, and descending labels while preserving the current defaults, and make Space activate sorting without scrolling. Done means localized labels are exposed through the component API and both Enter and Space behave as standard activation keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.