Combobox und Autovervollständigung richtig umsetzen
Erstellen Sie eine durchsuchbare Auswahl, die Screenreader verstehen.
Combobox und Autovervollständigung richtig umsetzen ist eine kostenlose Web Accessibility Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Web Accessibility Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Web Accessibility Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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. ✅
Häufig gestellte Fragen
Ist die Lektion „Combobox und Autovervollständigung richtig umsetzen“ kostenlos?
Ja — der vollständige Text von „Combobox und Autovervollständigung richtig umsetzen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Web Accessibility Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Web Accessibility Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Combobox und Autovervollständigung richtig umsetzen“?
Erstellen Sie eine durchsuchbare Auswahl, die Screenreader verstehen. Du übst Web Accessibility Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Web Accessibility Academy zu starten?
Keine Vorkenntnisse erforderlich. Web Accessibility Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Combobox und Autovervollständigung richtig umsetzen“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Web Accessibility Academy-Lektion Code schreiben und ausführen?
Ja. Jede Web Accessibility Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Das APG lesen: Muster, Tasten und Beispiele
- Combobox und Autovervollständigung richtig umsetzen
- Menu, Menubar und der Menü-Button
- Treegrid und andere fortgeschrittene Muster