primeng icon indicating copy to clipboard operation
primeng copied to clipboard

TreeTable: remove restricted aria attributes "aria-checked" and "aria-level"

Open B34v0n opened this issue 10 months ago • 0 comments

Describe the bug

Hi PrimeNG team.

While working on a11y in my project, I encountered some issues related to the usage of ARIA attributes in the Treetable component.

  1. aria-checked on elements As soon as any selection is enabled, every row get aria-checked="false" to indicate selection. But according to the ARIA-Specifications (https://www.w3.org/TR/wai-aria/#aria-checked), aria-checked is not allowed on rows (role="row"). Because of this, axe for example flags it as a violation.

    This should be replaced with aria-selected, which is valid for rows, if the table is set to role="grid" or role="treegrid".

    1. aria-level on elements in frozen columns Second thing is, that the frozen columns get the aria attribute aria-level. The frozen table uses role="table", so aria-level is not allowed there. It would be allowed, if the role is set to treegrid.

      So firstly, all the roles should be set to treegrid, because that is, what the treetable wants to achieve. And secondly, the aria-checked-attribute should be replaced by aria-selected, which would then be valid, if the role of the table is changed.

      Pull Request Link

      No response

      Reason for not contributing a PR

      • [x] Lack of time
      • [ ] Unsure how to implement the fix/feature
      • [ ] Difficulty understanding the codebase
      • [ ] Other

      Other Reason

      No response

      Reproducer

      https://primeng.org/treetable

      Environment

      All environments. Automated A11y-Testing with axe and jasmine.

      Angular version

      19.2.14

      PrimeNG version

      v19

      Node version

      22.15.0

      Browser(s)

      all browserd

      Steps to reproduce the behavior

      Aria-Level

      1. Go to https://primeng.org/treetable#frozencolumns
      2. Open DevTools
      3. Check attribute "aria-level" on <tr> on frozen Columns

      And aria-checked:

      1. Go to https://primeng.org/treetable#selection
      2. Open DevTools
      3. Check attribute "aria-checked" on <tr>

      Expected behavior

      Firstly, all the roles should be set to treegrid, because that is, what the treetable wants to achieve. And secondly, the aria-checked-attribute should be replaced by aria-selected, which would then be valid, if the role of the table is changed.

B34v0n avatar Jun 02 '25 12:06 B34v0n