Fehler mit aria-describedby an Felder binden
Sorgen Sie dafür, dass die Meldung zusammen mit dem Eingabefeld vorgelesen wird.
Fehler mit aria-describedby an Felder binden ist eine kostenlose Web Accessibility Academy-Lektion auf CoddyKit. Dies ist Lektion 1 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.
A Floating Error
An error message sitting near a field looks connected to you. But to a screen reader it is just loose text the user may never hear. ⚠️
The Fix Is a Link
You need to formally tie the message to its input. The attribute that does this is aria-describedby, and it lives on the field.
Point to an id
Give the error element an id, then set the input's aria-describedby to that same id. Now the two are officially linked.
<input id="email" aria-describedby="email-err">
<p id="email-err">Enter a valid email.</p>What the User Hears
When focus lands on the input, the screen reader reads the label, the type, and then the description. The error is no longer orphaned.
Name Then Description
aria-describedby does not replace the label. The label gives the name; describedby adds extra info that is read after it.
Multiple Descriptions
You can list several ids, space-separated. The browser reads them in order, so you can join a hint and an error together.
<input aria-describedby="hint err">Only When It Applies
Add the error id to aria-describedby only while the error is showing. Pointing at an empty or hidden node can read nothing or confuse users.
Keep the Text Real
The described element must hold real, visible text. aria-describedby reads its content, so an empty span describes nothing useful.
Hidden Targets Stay Silent
If the target has display none, most screen readers skip it. Keep error text rendered and visible so the description is actually announced.
Works With aria-invalid
Pair describedby with aria-invalid on the same field. One says this failed; the other says here is why. Together they tell the full story.
Not Just for Errors
The same attribute carries format hints too, like password rules. Errors are one common use, not the only one.
<input aria-describedby="pw-rule">
<p id="pw-rule">At least 8 characters.</p>Quick Check
How do you make a screen reader read an error with its field?
Recap
Tie errors to fields with aria-describedby pointing at a real, visible id. The screen reader then reads the field and its error together. ✅
Häufig gestellte Fragen
Ist die Lektion „Fehler mit aria-describedby an Felder binden“ kostenlos?
Ja — der vollständige Text von „Fehler mit aria-describedby an Felder binden“ 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 „Fehler mit aria-describedby an Felder binden“?
Sorgen Sie dafür, dass die Meldung zusammen mit dem Eingabefeld vorgelesen wird. 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 1 von 4.
Wie lange dauert die Lektion „Fehler mit aria-describedby an Felder binden“?
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
- Fehler mit aria-describedby an Felder binden
- Ungültigen Zustand mit aria-invalid markieren
- Fokus auf den ersten Fehler setzen
- Inline, bei Blur oder beim Absenden: Der Zeitpunkt zählt