Open DaveZIvy opened 3 months ago
Also getting this with IBM Accessibility checker, it's odd because things like Tabs properly hide/show these things... unsure as well of a solution here, also in test noticed tooltip/maybe popover might also suffer from this error
Same for Dialog. I'm not sure if aria-controls
is required, because the aria design pattern page for a dialog doesn't mention it https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
Same for Dialog. I'm not sure if
aria-controls
is required, because the aria design pattern page for a dialog doesn't mention it https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
Upon further investigation, I've confirmed that the aria-controls
attribute is optional and is only required in specific scenarios. According to the W3C's proposed rule, aria-controls
is mandatory only when:
combobox
role is expanded (aria-expanded="true"
).scrollbar
role.In other contexts, the use of aria-controls
is not obligatory. Therefore, if accessibility checkers, such as IBM's, flag the absence of aria-controls
as an error outside these specific cases, it may be a false positive. Moving forward, I'll consider these flags as non-critical and address them based on the specific context of each element.
Reference:
Bug report
Current Behavior
When using the menu trigger it creates
aria-controls=[id of dropdown]
but the dropdown doesn't exist on the page, so it comes up as invalid html, "Error: The aria-controls attribute must point to an element in the same document."Expected behavior
The
aria-controls
should reference an element in the DOM.Reproducible example
https://codesandbox.io/p/sandbox/crimson-cache-5x9z2d?
Suggested solution
I'm not sure, maybe just hiding the dropdown with css instead of removing it from the DOM?
Your environment