0Pricing
Web Accessibility Academy · Урок

Комбинированное поле и автодополнение без ошибок

Создавайте доступный для поиска список, понятный пользователям программ чтения с экрана.

«Комбинированное поле и автодополнение без ошибок» — бесплатный урок Web Accessibility Academy на CoddyKit. Это урок 2 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения Web Accessibility Academy, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс Web Accessibility Academy содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

What a Combobox Is

A combobox is an input paired with a popup of suggestions. Think search boxes that drop down matching results as you type. 🔍

Two Parts Working Together

A combobox has a text input the user types into and a separate popup listbox of options. ARIA wires the two so screen readers connect them.

Role on the Input

You put role="combobox" on the text input itself. This tells assistive tech that typing here will reveal a list of choices.

<input role="combobox" aria-expanded="false"
  aria-controls="results" type="text">

Point to the Popup

Use aria-controls on the input, set to the id of the popup. It links the field to the listbox it opens and closes.

Announce Open or Closed

Toggle aria-expanded to true when the list shows and false when it hides. Screen readers announce the popup state from this attribute.

The Popup Is a Listbox

The suggestions container takes role="listbox" and each suggestion is role="option". This gives users a familiar, navigable list.

<ul id="results" role="listbox">
  <li role="option" id="o1">Apple</li>
</ul>

Focus Stays in the Input

The trick: keyboard focus never leaves the input. The user keeps typing while arrow keys move a highlight through the options.

aria-activedescendant

Point aria-activedescendant on the input at the id of the highlighted option. That is how a screen reader reads the active choice without moving real focus.

<input role="combobox"
  aria-activedescendant="o1">

The Expected Keys

Down and Up Arrow move through options, Enter selects the active one, and Escape closes the popup. These keys come straight from the APG.

Mark the Chosen Option

Set aria-selected="true" on the highlighted option and false on the rest. Only one option should be selected at a time in a single-select combobox.

Autocomplete Behavior

Use aria-autocomplete to describe how suggestions appear: "list" for a filtered menu or "both" when text is also completed inline.

Quick Check

The user arrows down through your combobox suggestions. Which attribute tells the screen reader which option is active?

Recap

A combobox is an input plus a listbox: wire them with aria-controls and aria-expanded, keep focus in the field, and track the active option with aria-activedescendant. ✅

Часто задаваемые вопросы

Урок «Комбинированное поле и автодополнение без ошибок» бесплатный?

Да — полный текст урока «Комбинированное поле и автодополнение без ошибок» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Web Accessibility Academy, подпишись на CoddyKit PRO. Курс Web Accessibility Academy содержит 4 уроков всего.

Чему я научусь в уроке «Комбинированное поле и автодополнение без ошибок»?

Создавайте доступный для поиска список, понятный пользователям программ чтения с экрана. Ты практикуешь Web Accessibility Academy с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать Web Accessibility Academy?

Предыдущий опыт не требуется. Web Accessibility Academy на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 2 из 4.

Сколько времени занимает урок «Комбинированное поле и автодополнение без ошибок»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке Web Accessibility Academy?

Да. Каждый урок Web Accessibility Academy включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Чтение APG: шаблоны, клавиши и примеры
  2. Комбинированное поле и автодополнение без ошибок
  3. Меню, панель меню и кнопка меню
  4. Дерево-таблица и другие продвинутые шаблоны
← Назад к Web Accessibility Academy