form-field-multiple-labels
它能做什么
这项技能检查附加了多个标签的表单字段。适用于希望表单字段对辅助工具而言清晰明确的开发者。
适用场景
- ✓当一个表单字段被两个不同的文字元素标记的时候。
- ✓当屏幕阅读器把字段名称读了两遍,或读得很奇怪的时候。
- ✓当你审查来自组件库的表单标记的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/form-field-multiple-labels/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的每个表单字段是否只有一个标签。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会查找关联到多个 label 元素的输入框。它会建议把它们合并为一个标签,或在名称由多部分组成时使用 aria-labelledby。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Use a single label for each form field
Multiple labels for a single field can cause screen readers to announce redundant information or fail to correctly associate the input with its purpose.
Quick Reference
- Associate each form input with exactly one <label> element
- Use aria-labelledby if multiple pieces of text must label a single field
- Avoid duplicate labels that can confuse screen readers and voice control
Check
Search for form inputs that are associated with more than one <label> element.
Fix
Consolidate multiple labels into a single <label> or use aria-labelledby to reference multiple sources of text.
Explain
Explain how a 1:1 relationship between labels and inputs ensures clarity for assistive technology users.
Code Review
Review the rendered markup and interactive states that affect Use a single label for each form field. 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/form-field-multiple-labels
常见问题
多个标签为什么是个问题?
屏幕阅读器可能会播报重复的信息,或无法将输入框与其用途关联起来。
什么时候使用 aria-labelledby?
这项技能建议在多段文字需要共同为一个字段命名时使用它。
如何检查修复是否有效?
这项技能建议使用浏览器的无障碍工具或辅助技术进行检查。
详情
作者的原始描述
Use when reviewing rendered HTML, interactive components, or design-system patterns related to Use a single label for each form field. Check native semantics first, then inspect keyboard behavior, focus flow, accessible names, and screen-reader output where relevant.
热度
- GitHub 星标
- 75k
- 排名
- #2856
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。