TreeTable: remove restricted aria attributes "aria-checked" and "aria-level"
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.
- 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 torole="grid"orrole="treegrid".- aria-level on
elements in frozen columns Second thing is, that the frozen columns get the aria attribute aria-level. The frozen table usesrole="table", soaria-levelis not allowed there. It would be allowed, if the role is set totreegrid.So firstly, all the roles should be set to
treegrid, because that is, what the treetable wants to achieve. And secondly, thearia-checked-attribute should be replaced byaria-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
- Go to https://primeng.org/treetable#frozencolumns
- Open DevTools
- Check attribute "aria-level" on
<tr>on frozen Columns
And aria-checked:
- Go to https://primeng.org/treetable#selection
- Open DevTools
- 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, thearia-checked-attribute should be replaced byaria-selected, which would then be valid, if the role of the table is changed.
- aria-level on