primefaces / primefaces/primereact
DataTable: Column header always rendered in a span element
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Passing a custom header element to the Column always renders it inside the <span>, which is often not correct for accessibility. A lot of elements can not be rendered as children of span e.g. div.
Reproducer
https://stackblitz.com/edit/xuskzp8u
System Information
primereact: 10.9.7
Steps to reproduce the behavior
- Create a DataTable
- In one of the columns provide a
headerprop that is not a simple string value, but a function returning some element e.g. - Inspect page. Notice that the is rendered inside a which is not correct.
Expected behavior
If the custom header is provided it should render it inside a div instead of span to maintain correct accessibility.
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 with the DataTable and Column header rendering used by the linked StackBlitz reproducer, then trace where custom header content is wrapped. Confirm the current markup for string and element headers, and verify that custom elements no longer receive an invalid span wrapper while ordinary headers retain their expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100