Fix aria-required-children axe errors
A composite ARIA role does not contain the child roles required to expose its internal structure.
Кого затрагивает
Screen-reader users navigating composite widgets such as listboxes, menus, trees and tablists.
Связь с WCAG
1.3.1 Info and Relationships (A)
Обнаружение
wcagc checks whether rendered composite roles contain the owned child roles required by axe-core's ARIA hierarchy.
Почему возникает эта ошибка
- Visual option elements are plain divs without the required child role.
- A framework portal moves owned children outside the composite without an appropriate relationship.
- Conditional rendering temporarily leaves the parent empty or with the wrong descendants.
Проблемная разметка
<div role="listbox" aria-label="Colour"><div>Red</div></div>Исправленный код
<div role="listbox" aria-label="Colour"><div role="option" aria-selected="false">Red</div></div>Проверьте исправление вручную
Navigate the complete widget with a screen reader and keyboard. Confirm that item count, selected state and movement among child items are announced and operated as expected.
Границы автоматизации
Correct parent and child roles do not implement the keyboard pattern, selection management or focus behavior required by the widget.
Источники и стандарты
Метаданные правила и ссылка Deque генерируются из axe-core 4.12.1. Ссылка W3C ведёт на нормативное руководство WCAG для соответствующего критерия.
Вопросы разработчиков
Can aria-owns repair a portalled widget?
It can express ownership in limited cases, but it also changes reading order. Prefer a simpler DOM relationship when possible and test the result with assistive technology.
Is adding role=option enough for a listbox?
No. You must also implement focus, keyboard navigation and selection state according to the listbox interaction pattern.
Одно нарушение редко встречается в одиночку
Запустите проверку страницы в wcagc, чтобы найти это правило, связанные проблемы WCAG, затронутые селекторы и пункты, требующие ручной оценки.
Проверить страницу