Skip to main content

HTML Guide

An element with “role=columnheader” must be contained in, or owned by, an element with “role=row”.

A role="columnheader" element must be a child of or associated with a role="row" element.

In HTML, ARIA roles such as columnheader are used to improve accessibility for assistive technologies. According to the ARIA specification, a columnheader role should appear inside an element with role="row", which itself should be inside an element with role="table" or role="grid". This structure mimics how native tables are constructed with <th> elements inside <tr>s.

Correct structure:

  • role="table" or role="grid" contains one or more elements with role="row".
  • Each role="row" contains one or more elements with role="columnheader" (or role="cell").

Example using ARIA roles for a simple table:

<div role="table" aria-label="Sample Table">
  <div role="row">
    <div role="columnheader">Name</div>
    <div role="columnheader">Age</div>
  </div>
  <div role="row">
    <div role="cell">Alice</div>
    <div role="cell">30</div>
  </div>
</div>

Best practice:
Whenever possible, use native table elements, which have built-in roles and accessibility, reducing the chance of ARIA misuse.

Example using native table markup:

<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Alice</td>
    <td>30</td>
  </tr>
</table>

Ensure that any element with role="columnheader" is always contained within a parent with role="row". Avoid placing role="columnheader" directly inside a container without the appropriate role="row" ancestor.

Learn more:

Related W3C validator issues