p-tree renders invalid html for accessibility #7550
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
No necessary.
Current behavior
Role of containing 'ul' element in tree DOM is overriden to role="tree" leaving child 'li' elements without parent with correct role.
<p-tree>
<div class="ui-tree ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tree-container" role="tree">
<p-treenode>
<li class="ui-treenode ui-treenode-leaf" >
<div class="ui-treenode-content" role="treeitem" tabindex="0" draggable="false" aria-posinset="1" aria-selected="false">
<span class="ui-tree-toggler pi pi-fw ui-unselectable-text pi-caret-right"></span>
<span class="ui-treenode-label ui-corner-all" >
<span>Backup</span>
</span>
</div>
</li>
</p-treenode>
</ul>
</div>
</p-tree>
Found out with Axe chrome plugin (accessibility testing tool): https://www.deque.com/axe/
Expected behavior
Role of child elements should be probably overriden too. Simple solution could be moving role="treeitem" from div.ui-treenode-content to it's parent li element.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Correct HTML accessibility tree;
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: