Skip to content

Table and TreeTable: missing scope attribute on th elements causes td-has-header a11y violation #19635

Description

@fkwq34

Describe the bug

elements in Table and TreeTable components lack proper header associations, causing the _td-has-header_ accessibility rule to fail.

Affected components:

Table (p-table)
TreeTable (p-treetable)
References:

axe rule: td-has-header
WCAG: 1.3.1 Info and Relationships (Level A)

Pull Request Link

#19636

Reproducer

https://stackblitz.com/edit/github-hrd4vzvf?file=src%2Fapp%2Fapp.component.ts

Environment

A library that wraps primeng and provide its own styling.

Angular version

21

PrimeNG version

v21

Node version

No response

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the Table demo page (e.g., Basic Table example)
  2. Run an accessibility audit using browser DevTools (Lighthouse) or axe DevTools extension
  3. Observe the td-has-header violation is reported

Or manually:

  1. Open browser DevTools
  2. Inspect any element in the table header
  3. Notice the scope attribute is missing

Expected behavior

All elements in Table and TreeTable should have scope="col" attribute automatically applied, ensuring:

  • Screen readers announce column headers when navigating to data cells
  • The td-has-header axe accessibility rule passes
  • WCAG 1.3.1 (Info and Relationships) compliance is met

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: AccessibilityIssue or pull request is related to WCAG or ARIAType: BugIssue contains a bug related to a specific component. Something about the component is not working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions