Langsung ke konten
Skillpedia
Website & UI (frontend)75k Β· #2735

aria-required-children

Fungsinya

Skill ini memeriksa widget komposit seperti daftar tab, menu, dan pohon untuk elemen anak yang tepat. Cocok untuk pengembang yang membangun tab, daftar, atau menu kustom dari elemen div dan span.

Kapan dipakai

  • βœ“Saat Anda membangun kumpulan tab, menu, atau listbox kustom dari elemen div.
  • βœ“Saat pembaca layar tidak mengumumkan jumlah item dalam daftar atau menu.
  • βœ“Saat Anda membangun kontrol daftar, pilihan, atau navigasi kustom sebagai pengganti HTML asli.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/aria-required-children/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBilah tab kustom saya memakai div biasa. Pastikan item tab memiliki peran yang tepat di dalam daftar tab.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memeriksa setiap peran wadah terhadap peran anak yang harus dimilikinya, seperti tab di dalam tablist atau listitem di dalam list, dan menambahkan peran presentasi pada elemen pembungkus jika diperlukan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Ensure ARIA roles contain required child roles

Screen readers like NVDA and VoiceOver navigate composite widgets (menus, tabs, trees) by moving between the required child roles. If a tablist contains <div> elements instead of role='tab', the user hears no tabs at all. JAWS announces 'list of 5 items' only when role='listitem' children exist inside role='list'. Without correct nesting, the entire widget becomes opaque to keyboard-only and screen reader users.

Quick Reference

  • Container roles mandate specific owned child roles: tablist β†’ tab, list/listbox β†’ listitem/option, menu/menubar β†’ menuitem, tree β†’ treeitem, grid/rowgroup β†’ row
  • Missing required children break the accessibility tree so screen readers cannot enumerate items or announce counts
  • Use role='none' or role='presentation' on purely structural wrapper elements inside the container to avoid invalid nesting
  • Applies to WAI-ARIA 1.2 required owned elements for composite widget roles

Check

Identify all elements with ARIA container roles (tablist, list, listbox, menu, menubar, tree, treegrid, grid, rowgroup, radiogroup). For each, verify it contains the required owned child roles per the WAI-ARIA spec: tablist must own tab elements; list must own listitem; listbox must own option; menu/menubar must own menuitem, menuitemcheckbox, or menuitemradio; tree must own treeitem; grid must own row (which owns gridcell); radiogroup must own radio. Flag any container roles missing required children.

Fix

For each container role missing its required children: (1) Add the correct role to each child element β€” e.g., add role='tab' to each tab button inside role='tablist'. (2) If wrapper <div> elements exist between the container and the required children for layout purposes, add role='none' or role='presentation' to those wrappers. (3) Prefer native HTML equivalents where possible: <ul>/<li> instead of role='list'/role='listitem', <select>/<option> instead of role='listbox'/role='option'.

Explain

WAI-ARIA 1.2 defines 'required owned elements' for composite widget roles β€” these are the child roles a container must contain for the widget to be valid. Screen readers build their understanding of a widget from this structure. A tablist without tab children means a screen reader user in Forms Mode will find nothing to navigate between. A menu without menuitem children will not be announced as a menu at all in some ATs. This is distinct from aria-required-parent, which checks the inverse direction.

Code Review

Review the rendered markup and interactive states that affect Ensure ARIA roles contain required child roles. 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-required-children

Pertanyaan umum

Apa yang terjadi jika peran anak hilang?

Skill menyatakan pembaca layar mungkin tidak mengumumkan item atau jumlahnya, yang merusak navigasi.

Untuk apa peran none?

Peran itu menandai pembungkus yang murni struktural agar tidak merusak struktur yang diwajibkan.

Peran apa saja yang disebut sebagai contoh?

Skill menyebut tab di dalam tablist, listitem di dalam list, option di dalam listbox, dan menuitem di dalam menu.

Detail

Deskripsi asli dari pembuat

Use when applies to custom ARIA widgets using composite roles: tablist, list, listbox, menu, menubar, tree, treegrid, grid, rowgroup, row, radiogroup. Use when reviewing components built with div/span elements that replace native HTML list, select, or nav elements.

repo: thedaviddias/Front-End-Checklist

Popularitas

Bintang GitHub
75k
Peringkat
#2735
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa