跳到正文
Skillpedia
网站与界面(前端)75k · #2856

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/form-field-multiple-labels/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2856
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能