Expectation:
<ol role="tree"></ol>
should generate no errors.
Actual: It generates the following error:
aria-required-children: Certain ARIA roles must contain particular children WCAG 1.3.1
Motivation: A tree that has no leaves is still a tree, and therefore role="treeitem" should not be a required child of an element of role="tree".
axe-core version: 3.0.0-alpha1, 3.1.1
We ran into this issue as well in a product that allows user interaction to insert tree items. The empty role="tree" exists before any tree items have been inserted.
There are examples of empty trees existing on desktop applications in Windows applications, so it's not a completely unknown pattern. An example might be in something like this: https://www.lightningdesignsystem.com/components/dueling-picklist/ where instead of listboxes there are selectible tree views, and all items are removed from one side.
I agree. I think generally the aria-required-children rule isn't quite right and should probably be more of an "allowed children" type rule, similar to what we've done with the list rules.
Thank you for reporting. We'll definitely pick this up.
@WilcoFiers how exactly would you like to handle this? It seems related to #874 and #383
@straker The aria-required-children check has an option for reviewEmpty, which when we put a role in there, puts the results into "needs review" rather than failing it. I think it should have the following items in it, so that they are put into needs review:
That would make only the following roles fail if they are left empty:
Verified for the required test file, not seeing any voilations, but observed "Needs review" issue.
(Attached the screenshot)
Tested Environment:
Axe-coconut - 3.8.0.14704v
Chrome - 74v
OS - Windows 10 64 bit
Most helpful comment
I agree. I think generally the aria-required-children rule isn't quite right and should probably be more of an "allowed children" type rule, similar to what we've done with the list rules.
Thank you for reporting. We'll definitely pick this up.