Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)75k · #2741

aria-treeitem-name

Was er macht

Dieser Skill prüft, ob Elemente in Baum-Widgets klare Namen und Zustände für geöffnet haben. Er ist für Entwickler gedacht, die Dateiexplorer, verschachtelte Menüs oder Organigramme bauen.

Wann du ihn nutzt

  • ✓Wenn du einen Dateiexplorer, eine verschachtelte Navigation oder eine Baumansicht baust.
  • ✓Wenn Baumelemente leere oder allgemeine Namen wie Ordner oder Element haben.
  • ✓Wenn aufklappbare Elemente nicht angeben, ob sie offen oder geschlossen sind.

Link zum Skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-treeitem-name/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-treeitem-name/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Mein Dateibaum zeigt Ordner, die Screenreader nur als Element ansagen. Behebe die Namen.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent prüft den Namen jedes Baumelements in dieser Reihenfolge: aria-labelledby, dann aria-label, dann sichtbarer Text, und bestätigt, dass aufklappbare Elemente einen Zustand für geöffnet haben.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Provide accessible names for tree items

Tree widgets represent hierarchical data (file explorers, nested navigation, organization charts). Screen readers announce each focused treeitem's name, level, and position — e.g., 'src, collapsed, level 1, 1 of 3'. If the name is empty or generic ('folder', 'item'), blind users cannot distinguish between nodes and cannot navigate the hierarchy with confidence. VoiceOver on macOS uses the name to populate the rotor, and NVDA reads it as the user moves through the tree with arrow keys.

Quick Reference

  • Every element with role='treeitem' must have a non-empty accessible name
  • Text content of the element is used as the name by default — ensure it is descriptive
  • Use aria-label to override or supplement the visible text (e.g., adding file type context)
  • Use aria-labelledby to compose a name from multiple visible elements within the item
  • A treeitem with aria-expanded must also convey its expanded/collapsed state — this is separate from its name

Check

Find all elements with role='treeitem'. For each, determine its accessible name via the accname computation: check aria-labelledby first, then aria-label, then visible text content. Flag any treeitem with an empty or whitespace-only accessible name. Also check whether treeitems with children have aria-expanded set to 'true' or 'false' (not just absent).

Fix

For each unnamed treeitem: (1) If the element has visible text content that is descriptive, no change is needed — the text content becomes the accessible name. (2) If the visible text is ambiguous (e.g., an icon with no text), add aria-label='Descriptive name'. (3) If the item has multiple text parts (e.g., filename + file size), use aria-labelledby referencing the most descriptive element's id. (4) For expandable treeitems, ensure aria-expanded='true' or aria-expanded='false' is present and toggled on expand/collapse.

Explain

WAI-ARIA 1.2 requires that treeitem elements have an accessible name as part of the tree widget pattern. Screen readers convey position within the tree using: name + level (aria-level or DOM nesting depth) + set size (aria-setsize) + position in set (aria-posinset) + expanded state (aria-expanded). The name is the only user-facing identifier — without it, a user navigating by arrow keys hears only 'treeitem, level 2' with no way to know which node they are on.

Code Review

Review the rendered markup and interactive states that affect Provide accessible names for tree items. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/accessibility/aria-treeitem-name

Häufige Fragen

Was sagt ein Screenreader bei einem guten Baumelement?

Der Skill gibt ein Beispiel wie src, eingeklappt, Ebene 1, 1 von 3, das Name, Zustand und Position enthält.

Welchen Namen nutzt der Screenreader zuerst?

Der Skill beschreibt, dass zuerst aria-labelledby geprüft wird, dann aria-label und danach der sichtbare Text.

Braucht ein aufklappbares Element einen eigenen Zustand?

Ja. Der Skill sagt, Elemente mit Kindern brauchen aria-expanded mit dem Wert true oder false.

Details

Originalbeschreibung des Autors

Use when applies to custom tree widgets built with role='tree', role='treeitem', and role='group'. Common in file explorers, nested navigation menus, org charts, and any UI where items can be expanded or collapsed to reveal children.

repo: thedaviddias/Front-End-Checklist

Beliebtheit

GitHub-Sterne
75k
Platz im Ranking
#2741
Lizenz
MIT
Aktualisiert
31.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills