Fix aria-roles axe errors
A role attribute is empty, misspelled or contains no recognized ARIA role, so the element's intended semantics are not exposed.
Кого затрагивает
Assistive-technology users who depend on roles to identify controls, landmarks and document structure.
Связь с WCAG
4.1.2 Name, Role, Value (A)
Обнаружение
wcagc validates explicit role tokens in the rendered DOM against the roles supported by axe-core.
Почему возникает эта ошибка
- A role name is misspelled.
- A deprecated or abstract ARIA role is copied from an old example.
- A custom control uses role instead of an equivalent native element.
Проблемная разметка
<div role="buton" tabindex="0">Save</div>Исправленный код
<button type="button">Save</button>Проверьте исправление вручную
Inspect the accessibility tree and operate the component with a keyboard and screen reader. Confirm that the resulting role matches the interaction users actually receive.
Границы автоматизации
A recognized role can still be inappropriate for the element or interaction. Passing this rule does not prove that required properties or keyboard behavior exist.
Источники и стандарты
Метаданные правила и ссылка Deque генерируются из axe-core 4.12.1. Ссылка W3C ведёт на нормативное руководство WCAG для соответствующего критерия.
Вопросы разработчиков
Should I correct the role or replace the element?
Prefer the native element when one matches the behavior. It supplies semantics and keyboard behavior with less code than a custom role.
Can an element contain more than one role token?
Browsers use the first supported token. Fallback tokens have specialized uses, but they should not be used to hide uncertainty about the intended role.
Одно нарушение редко встречается в одиночку
Запустите проверку страницы в wcagc, чтобы найти это правило, связанные проблемы WCAG, затронутые селекторы и пункты, требующие ручной оценки.
Проверить страницу