icflorescu / icflorescu/mantine-datatable
Sortable header cells: localizable sort labels and Space activation
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):
-
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, unlikenoRecordsText,loadingTextorrecordsPerPageLabel.sortIconsreplaces the icon but keeps the English label around it. For a non-English UI, screen reader users hear a mix of languages. -
Space does not activate the header. The cell is rendered with
role="button"andtabIndex={0}, butonKeyDownonly handlesEnter. Space is the other standard activation key for buttons; pressing it does nothing and scrolls the page.
Suggested API
- A
sortLabelsprop (or similar) with{ unsorted, ascending, descending }strings, defaulting to the current English ones. - Handle
' 'alongside'Enter'in the header cell'sonKeyDown, withpreventDefault()so the page does not scroll. - Optionally,
aria-sorton the<th>; note that withrole="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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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