list-structure
它能做什么
这项技能检查 HTML 列表是否只把列表项作为直接子元素。适用于希望列表能与辅助技术良好配合的网页制作者。
适用场景
- ✓当你请智能体检查页面中列表的 HTML 标记的时候。
- ✓当列表在屏幕上看起来正常,但你怀疑其代码结构无效的时候。
- ✓当模板或组件输出列表,而你想确认它们符合正确结构的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/list-structure/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查网站上的列表结构,看看屏幕阅读器能否正确读取。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查每个 ul 和 ol 元素,查找不是 li 元素的直接子元素。然后它会移动或包裹这些元素,使列表结构有效。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Use correct list structure
Screen readers rely on a specific parent-child relationship for lists to correctly announce the number of items and the user's current position within the list.
Quick Reference
- Unordered (
<ul>) and ordered (<ol>) lists must only contain<li>elements - Do not put other elements like
<div>or<p>directly inside a list - Ensure nested lists are also properly contained within an
<li>element
Check
Check the structure of all lists to ensure only <li> elements are direct children of <ul> or <ol>.
Fix
Remove or move any non-li elements from within <ul> and <ol> tags.
Explain
Explain why assistive technology needs a consistent list structure to provide accurate navigation information.
Code Review
Review the rendered markup and interactive states that affect Use correct list structure. 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/list-structure
常见问题
列表中直接包含 div 有什么问题?
屏幕阅读器依赖清晰的父子关系,多余的元素可能会干扰项目数量和位置的判断。
列表可以嵌套吗?
可以,但嵌套的列表必须放在列表项元素之内。
这会改变列表的外观吗?
可能会。如果样式依赖于错误的结构,修复后应检查布局。
详情
作者的原始描述
Use when reviewing rendered HTML, interactive components, or design-system patterns related to Use correct list structure. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.
热度
- GitHub 星标
- 75k
- 排名
- #2923
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。