Перейти к содержанию
Skillpedia
Сайты и интерфейсы (фронтенд)75k · #2741

aria-treeitem-name

Что он делает

Этот скилл проверяет, что элементы виджетов-деревьев имеют понятные имена и состояния раскрытия. Он предназначен для разработчиков, которые создают файловые менеджеры, вложенные меню или организационные схемы.

Когда использовать

  • ✓Когда вы создаете файловый менеджер, вложенную навигацию или представление дерева.
  • ✓Когда у элементов дерева пустые или общие имена, например folder или item.
  • ✓Когда раскрываемые элементы не сообщают, открыты они или закрыты.

Ссылка на скилл

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

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-treeitem-name/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“В моем дереве файлов папки программы чтения объявляют только как item. Исправь имена.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Агент проверяет имя каждого элемента дерева, используя сначала aria-labelledby, затем aria-label, затем видимый текст, и подтверждает, что раскрываемые элементы имеют состояние раскрытия.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с 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

Частые вопросы

Что программа чтения говорит о хорошем элементе дерева?

Скилл приводит пример вроде «src, свернуто, уровень 1, 1 из 3», где есть имя, состояние и положение.

Какое имя программа чтения использует первым?

Скилл описывает проверку сначала aria-labelledby, затем aria-label, затем видимого текста.

Нужно ли раскрываемому элементу свое состояние?

Да. В скилле сказано, что у элементов с дочерними пунктами aria-expanded должен быть равен true или false.

Подробности

Оригинальное описание автора

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

Популярность

Звёзды на GitHub
75k
Место в рейтинге
#2741
Лицензия
MIT
Обновлён
31.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы