TreeView: Remove aria-describedby when leading and trailing visuals do not exist
Description
We are using TreeView in the NestedListView and I came across this warning in the axe tests: ARIA attribute element ID does not exist on the page: aria-describedby=":r3: :r4:". The aria-describedby is set in the TreeView Primer component by the leading visual and the trailing visual. Because the NestedListView does not use the TreeView.LeadingVisual and TreeView.TrailingVisual, the ids do not exist on the page.
Steps to reproduce
- Go to Storybook Recipes > NestedListView > Example
- Open Accessibility tab in the Add Ons panel
- Click the Incomplete tab to view test warnings
- Notice "ARIA attributes must conform to valid values"
Version
v36.12.0
Browser
Chrome
Just going to mention that having aria-describedby pointing to a non-existent id (or even having the attribute, pointing to nothing, a la aria-describedby="") won't have an adverse effect as such, and is more of a "code quality" issue. Of course, if it's easy to avoid, then by all means you should go for fixing it.
Thanks @JelloBagel for filing this issue. We agree it is better to fix it and It is in our backlog now.