primereact icon indicating copy to clipboard operation
primereact copied to clipboard

DataTable: Column header always rendered in a span element

Open KubaGorka opened this issue 4 months ago • 0 comments

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

  1. Create a DataTable
  2. In one of the columns provide a header prop that is not a simple string value, but a function returning some element e.g.
  3. 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.

KubaGorka avatar Sep 15 '25 13:09 KubaGorka