Fix select-name axe errors
A select element has no accessible name, so users cannot determine what choice the control represents.
Кого затрагивает
Screen-reader users, speech-input users, and people who need persistent visible labels for form controls.
Связь с WCAG
4.1.2 Name, Role, Value (A)
Обнаружение
wcagc reports select elements whose computed accessible name is empty.
Почему возникает эта ошибка
- The visible caption is not associated with the select.
- A label for value does not match the select id.
- A custom select wrapper drops the accessible-name prop.
Проблемная разметка
<select><option>Poland</option></select>Исправленный код
<label for="country">Country</label>
<select id="country" name="country"><option>Poland</option></select>Проверьте исправление вручную
Navigate to the select with a screen reader and speech input. Confirm that its visible label, accessible name, current value and required state are all announced accurately.
Границы автоматизации
Automation can detect a missing name, but not whether option labels are clear, whether groups are meaningful, or whether instructions explain the choice.
Источники и стандарты
Метаданные правила и ссылка Deque генерируются из axe-core 4.12.1. Ссылка W3C ведёт на нормативное руководство WCAG для соответствующего критерия.
Вопросы разработчиков
Does the first option label the select?
No. An option is a value inside the control, not its accessible name. Provide a visible associated label.
Can aria-label name a select?
Yes, but use a visible label when possible so sighted users also retain the control's purpose before and after choosing a value.
Одно нарушение редко встречается в одиночку
Запустите проверку страницы в wcagc, чтобы найти это правило, связанные проблемы WCAG, затронутые селекторы и пункты, требующие ручной оценки.
Проверить страницу