0Pricing
Web Accessibility Academy · Lektion

tabindex 0, -1 und niemals positiv

Steuern Sie, was fokussierbar und was nur per Skript erreichbar ist.

tabindex 0, -1 und niemals positiv 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 tabindex Controls

The tabindex attribute decides whether an element can receive keyboard focus and how it fits into the Tab order. It is your dial for focusability.

Most Things Are Already Focusable

Links, buttons, and inputs are focusable by default, so you rarely touch tabindex on them. Reach for it only when the native element cannot do the job.

tabindex 0 Joins the Order

Setting tabindex="0" puts a normally non-focusable element into the natural Tab order, right where it sits in the DOM.

<div role="button" tabindex="0">Custom action</div>

When to Use 0

Use tabindex="0" on a custom widget you built from a div or span that must be reachable by keyboard, like a scripted toggle.

tabindex -1 Means Scriptable Only

With tabindex="-1", an element is skipped by the Tab key but can still be focused from JavaScript using element.focus().

<div id="panel" tabindex="-1">Result area</div>

Why -1 Is So Useful

You use tabindex="-1" to move focus to a region after an action, like a results panel, without adding it to every Tab press. 🎯

Never Use Positive Values

A positive tabindex like 3 jumps that element ahead of everything, scrambling the order and trapping you in a maze. Avoid it.

<input tabindex="3">

Positive Values Break the Flow

Any element with a positive value is visited before all the tabindex="0" and default elements, so the focus order stops matching the visual order.

Let the DOM Set the Order

The cleanest Tab order comes from DOM order itself. Arrange your markup logically and most focus problems disappear on their own.

Do Not Make Everything Focusable

Adding tabindex="0" to plain text or whole containers creates noise, forcing keyboard users to Tab through stops that do nothing.

A Simple Rule of Thumb

Use 0 to add a custom control to the order, -1 to focus by script only, and never a positive number. That covers almost everything.

Quick Check

Which tabindex value makes an element focusable by script but skips it in the Tab order?

Recap

You now own the tabindex dial: 0 adds custom controls to the order, -1 enables scripted focus, and positive values are off-limits. 👍

Häufig gestellte Fragen

Ist die Lektion „tabindex 0, -1 und niemals positiv“ kostenlos?

Ja — der vollständige Text von „tabindex 0, -1 und niemals positiv“ 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 „tabindex 0, -1 und niemals positiv“?

Steuern Sie, was fokussierbar und was nur per Skript erreichbar ist. 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 „tabindex 0, -1 und niemals positiv“?

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

  1. tabindex 0, -1 und niemals positiv
  2. Fokus nach einer Aktion verschieben
  3. Fokus beim Schließen einer Ebene zurückgeben
  4. Roving tabindex in Widgets verwalten
← Zurück zu Web Accessibility Academy