Das Tabs-Muster: tablist, tab, tabpanel
Verknüpfen Sie die drei Rollen, die eine Tab-Gruppe benötigt.
Das Tabs-Muster: tablist, tab, tabpanel 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.
What a Tab Set Really Is
A tab set shows one panel at a time and lets users switch between them. To assistive tech it must look like one widget, not loose links.
Three Roles Work Together
The pattern relies on three ARIA roles: a tablist that holds the tabs, each tab, and the panel each tab reveals. Get all three right.
The Container Is a tablist
Wrap your row of tabs in an element with role="tablist". This tells screen readers the children inside are a related set of tabs.
<div role="tablist">...</div>Each Tab Is a Button
Build each tab from a real button with role="tab". A button is focusable and clickable for free, so you avoid extra wiring.
<button role="tab">Profile</button>The Panel Is a tabpanel
The content each tab shows gets role="tabpanel". This marks it as the region controlled by the currently selected tab.
<div role="tabpanel">Profile details</div>Mark the Selected Tab
Set aria-selected="true" on the active tab and false on the rest. Screen readers announce which tab is currently chosen.
<button role="tab" aria-selected="true">Profile</button>Link Tab to Its Panel
Point each tab at its panel with aria-controls, set to the panel id. Users learn which region the tab opens.
<button role="tab" aria-controls="p1">Profile</button>Name the Panel From Its Tab
Give the panel an aria-labelledby that points back to its tab. Now the panel borrows the tab text as its accessible name.
<div role="tabpanel" aria-labelledby="tab1">...</div>Hide the Inactive Panels
Only one panel should show at a time. Add the hidden attribute to the panels whose tab is not selected so they leave the page.
<div role="tabpanel" hidden>...</div>Give the Tablist a Label
A tablist deserves an aria-label describing its purpose, like Account settings. Users hear what the whole set of tabs is for.
<div role="tablist" aria-label="Account settings">...</div>How It All Sounds
Put together, a screen reader announces something like Profile, tab, selected, 1 of 3. That orientation is exactly what makes tabs usable.
Quick Check
You are wiring up the container that holds your row of tabs. Which role belongs on it?
Recap: The Tabs Pattern
You learned the tablist, tab, tabpanel trio. Mark the selected tab, link each tab to its panel, and hide the inactive ones.
Häufig gestellte Fragen
Ist die Lektion „Das Tabs-Muster: tablist, tab, tabpanel“ kostenlos?
Ja — der vollständige Text von „Das Tabs-Muster: tablist, tab, tabpanel“ 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 „Das Tabs-Muster: tablist, tab, tabpanel“?
Verknüpfen Sie die drei Rollen, die eine Tab-Gruppe benötigt. 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 „Das Tabs-Muster: tablist, tab, tabpanel“?
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 Tabs-Muster: tablist, tab, tabpanel
- Navigation zwischen Tabs mit Pfeiltasten
- Akkordeons mit Button und aria-expanded
- Disclosure oder Tabs: das richtige Muster wählen