listitem
ما الذي تفعله
تجد هذه المهارة عناصر القائمة الموضوعة خارج قائمة، مثل داخل div أو span، وتصلحها. وهي موجهة إلى بناة الويب ومؤلفي القوالب الذين يريدون قوائم صالحة وسهلة الوصول.
متى تستخدمها
- ✓عندما تطلب من الوكيل التحقق من ترميز عناصر القائمة في صفحة أو قالب.
- ✓عندما يقسّم مكون ترميز القائمة على أجزاء كثيرة، وتشك في أن بعض العناصر ليس لها قائمة أم.
- ✓عندما تراجع قوائم ARIA المخصصة وتريد التأكد من أن عناصر القائمة داخل دور قائمة.
رابط المهارة
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/listitem/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هل تستطيع التحقق مما إذا كانت عناصر القائمة في موقعي تفتقد الحاوية الخاصة بها؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
ينظر الوكيل إلى كل عنصر قائمة ويتحقق من أن أبوه ul أو ol أو menu. وإذا لم يكن كذلك، يغلف العناصر بحاوية القائمة الصحيحة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Place list items within list containers
When a <li> element exists outside a list container, screen readers lose the ability to announce critical context: NVDA and JAWS will not say 'list of 5 items' or 'item 2 of 5' because there is no list context. VoiceOver may announce the orphan <li> as plain text without any group context, stripping users of the structural information that helps them understand how many items exist and where they are in the list.
Quick Reference
- Every
<li>element must have a direct parent of<ul>,<ol>, or<menu> - Orphan
<li>elements are invalid HTML per the HTML Living Standard - Screen readers announce list type and item count (e.g., 'list, 3 items') only when
<li>is inside a valid list container - Similarly,
role='listitem'must be owned by arole='list'element per WAI-ARIA requirements
Check
Find all <li> elements in the DOM. For each, check that its direct parent element is <ul>, <ol>, or <menu>. Flag any <li> whose parent is <div>, <section>, <nav>, <span>, or any element other than those three. Also check role='listitem' elements to ensure their closest ancestor with a list-related role is role='list'.
Fix
For each orphan <li>: (1) Wrap it and any sibling <li> elements in the appropriate list container — use <ul> for unordered items or <ol> for sequentially ordered items. (2) If the <li> was being used purely for styling (e.g., a bullet point visual), replace it with a <div> or <p> and apply the visual style via CSS. (3) If inside a navigation element, ensure <nav><ul><li> nesting is maintained.
Explain
The HTML Living Standard specifies that <li> elements are only valid as children of <ul>, <ol>, or <menu>. This is a structural requirement, not a style preference. Screen readers use the list container to announce the list type ('bullet list' vs 'numbered list') and the total item count. Without the container, this context is lost entirely. Additionally, when list-style: none is applied to a <ul>, some browsers strip the list semantics — if this is intentional (e.g., a navigation menu), add role='list' to the <ul> to restore list semantics for screen readers.
Code Review
Review the rendered markup and interactive states that affect Place list items within list containers. 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/listitem
الأسئلة الشائعة
لماذا يحتاج عنصر القائمة إلى أب قائمة؟
بدونه لا يستطيع قارئ الشاشة إخبار المستخدم بعدد العناصر أو موقعه داخل القائمة.
ما العناصر الأب المسموح بها؟
تذكر المهارة ul وol وmenu كآباء صالحة لعناصر القائمة.
ماذا عن سمات الدور المخصصة؟
تتحقق المهارة أيضًا من أن العناصر ذات الدور listitem موجودة داخل عنصر له دور list.
التفاصيل
الوصف الأصلي من المؤلف
Use when applies to HTML documents with `<li>` elements. Also applies to custom ARIA lists where `role='listitem'` must be owned by `role='list'`. Common violations occur in templating systems where list markup is split across components or in CSS resets where developers use `<li>` for layout without proper list parents.
الشعبية
- نجوم GitHub
- 75k
- الترتيب
- #2925
- الترخيص
- MIT
- آخر تحديث
- 31/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
frontendchecklist
75kيفحص شيفرة الواجهة الأمامية والصفحات الحية مقابل أكثر من 380 قاعدة للوصول وسرعة الأداء وتحسين محركات البحث والأمان، بأداة سطر أوامر.
frontend-checklist-global
75kيدقق مشروع الواجهة الأمامية وفق كل قواعد Front-End Checklist البالغ عددها 386، ويقدم إصلاحًا محددًا لكل مشكلة وجدت.
404-page
75kيتأكد من أن صفحة الصفحات غير الموجودة تقدم روابط مفيدة وتُرجع رمز حالة 404 حقيقيًا، لمساعدة الزوار التائهين على إيجاد طريقهم.
about-page
75kيراجع ما إذا كان لموقعك صفحة «من نحن» واضحة تشرح من يديره، لبناء الثقة لدى الزوار ومحركات البحث.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.