vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.13k stars 1.39k forks source link

Open/close state not reflected on aria-expanded attribute #2755

Closed ThainBBdL closed 1 week ago

ThainBBdL commented 10 months ago

On https://www.jstree.com/demo/ first demo, the aria-expanded attribute on the link element is not updated when opening/closing the node. It seems like the attribute is set on the i element above the link instead.

Side note, this is the only demo where I can reproduce this behavior.

vakata commented 1 week ago

There has been a lot of back and forth regarding the aria-attributes - unfortunately the spec is not clearly defined, and differs widely from various browser / reader implementations. This also means that different automated checkers report different errors and it is impossible to please them all. Let me know if you have an actual accessibility issue and I will reopen.

ThainBBdL commented 1 week ago

Thank you for your answer. Yes, there is still an issue as you can see on the first demo. At first the link tag contain an aria-expanded="false" attribute. When opening the node, an aria-expaned="true" attribute is added to the i element before it. Afterwards those nodes are not updated anymore whether nodes are open or closed so we stay with an aria state that don't reflect the tree:

<i class="jstree-icon jstree-ocl" role="presentation" aria-expanded="true"></i>
<a class="jstree-anchor  jstree-clicked" href="#" tabindex="-1" role="treeitem" aria-selected="true" aria-level="1" aria-expanded="false" id="demo_root_1_anchor" aria-busy="false">|...]Root 1</a>

IMHO, in this case the link should reflect the aria-expanded true/false as the i above is not a focusable element, doesn't have any content or an aria role.