primereact
primereact copied to clipboard
DataTable: Column header always rendered in a span element
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
headeris provided it should render it inside adivinstead ofspanto maintain correct accessibility. - Inspect page. Notice that the