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.mdSalin 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
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
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'orrole='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.
Popularitas
- Bintang GitHub
- 75k
- Peringkat
- #2735
- Lisensi
- MIT
- Diperbarui
- 31/10/2026
Komentar
- β¦
Skill lain dari repositori ini
frontendchecklist
75kMemeriksa kode frontend dan halaman langsung terhadap lebih dari 380 aturan untuk aksesibilitas, kecepatan, SEO, dan keamanan, dengan alat baris perintah.
frontend-checklist-global
75kMengaudit proyek frontend terhadap seluruh 386 aturan Front-End Checklist, dan memberikan perbaikan spesifik untuk setiap masalah yang ditemukan.
404-page
75kMemeriksa bahwa halaman tidak ditemukan Anda menawarkan tautan yang membantu dan mengembalikan status 404 yang sebenarnya, untuk membantu pengunjung yang tersesat.
about-page
75kMeninjau apakah situs Anda memiliki halaman Tentang yang jelas yang menjelaskan siapa yang mengelolanya, untuk membangun kepercayaan pengunjung dan mesin pencari.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.