0Pricing
Web Accessibility Academy · Leçon

aria-label ou aria-labelledby

Choisissez entre un nom intégré et un nom référencé.

aria-label ou aria-labelledby est une leçon Web Accessibility Academy gratuite sur CoddyKit. Ceci est la leçon 2 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Web Accessibility Academy, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Web Accessibility Academy comprend 4 leçons au total.

Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.

Two Ways to Name

When native labeling is not enough, you have two ARIA tools: aria-label for an inline string, and aria-labelledby to point at existing text.

aria-label Holds a String

Use aria-label when there is no visible text to borrow. You type the spoken name right on the element itself.

<button aria-label="Search">🔍</button>

aria-labelledby Holds an ID

Use aria-labelledby when visible text on the page can serve as the name. Its value is the id of that element, not a string.

<h2 id="sec">Billing</h2>
<section aria-labelledby="sec">...</section>

Prefer Visible Text

Reach for aria-labelledby first. Reusing on-screen text keeps the spoken name and the visible name in sync automatically.

labelledby Can Combine IDs

Give aria-labelledby several ids separated by spaces, and the browser joins their text in that order into one name.

<span aria-labelledby="verb noun">Go</span>
<span id="verb">Delete</span> <span id="noun">file</span>

labelledby Beats label

If both are present, aria-labelledby wins. The browser ignores aria-label entirely, so never expect them to merge.

An Element Can Name Itself

With aria-labelledby an element may reference its own id, which is handy for naming a region by its visible heading text.

label Is Invisible

An aria-label never appears on screen. It changes only what assistive tech announces, so sighted users see no difference.

Watch the Translation Trap

An aria-label is plain text that page translators often skip, while labelledby reuses visible content that does get translated.

IDs Must Match Exactly

An aria-labelledby id has to match a real element id. A typo silently leaves the element with no computed name at all.

Pick By Source of Truth

Ask where the name lives. If it is already on screen, use aria-labelledby; if it exists only for assistive tech, use aria-label.

Quick Check

A section already shows an h2 heading. How should you name the section?

Recap: label or labelledby

You learned to use aria-labelledby for existing visible text and aria-label for invisible inline names, never expecting them to combine. 🎯

Questions Fréquemment Posées

La leçon « aria-label ou aria-labelledby » est-elle gratuite ?

Oui — le texte complet de « aria-label ou aria-labelledby » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Web Accessibility Academy, passe à CoddyKit PRO. Le cours Web Accessibility Academy comprend 4 leçons au total.

Qu'est-ce que j'apprendrai dans « aria-label ou aria-labelledby » ?

Choisissez entre un nom intégré et un nom référencé. Tu pratiques Web Accessibility Academy avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.

Dois-je avoir de l'expérience pour commencer Web Accessibility Academy ?

Aucune expérience préalable n'est requise. Web Accessibility Academy sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 2 sur 4.

Combien de temps prend la leçon « aria-label ou aria-labelledby » ?

La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.

Peux-tu écrire et exécuter du code dans cette leçon Web Accessibility Academy ?

Oui. Chaque leçon Web Accessibility Academy inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.

Toutes les leçons de ce cours

  1. Le calcul du nom accessible, expliqué simplement
  2. aria-label ou aria-labelledby
  3. aria-describedby pour fournir un contexte supplémentaire
  4. Erreurs courantes de nommage qui rendent les contrôles muets
← Retour à Web Accessibility Academy