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

select-name

它能做什么

这个技能检查表单中每个 select 下拉菜单是否有正确的标签或无障碍名称。它面向希望表单对所有用户都完整可用的开发者。

适用场景

  • ✓你请智能体检查表单中下拉菜单的无障碍性的时候。
  • ✓屏幕阅读器用户听到一个下拉菜单,却不知道它的用途的时候。
  • ✓表单用第一个选项代替标签,而你希望修正这一点的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/select-name/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

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

可以这样问 AI

“请帮我检查表单上的每个下拉菜单是否都有屏幕阅读器能读取的正确标签吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会找到每个 select 元素,并检查是否有关联的标签、aria-label 或 aria-labelledby 值。如果都没有,它会添加一个通过 id 与该下拉菜单相连的标签。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Provide accessible names for select elements

Without an accessible name, screen reader users will not know what information the dropdown is asking for, making forms impossible to complete.

Quick Reference

  • Use the <label> element with a matching for attribute for every <select>
  • Alternatively, use aria-label or aria-labelledby if a visible label is not possible
  • Avoid using the first option as a replacement for a proper label

Check

Check that every <select> element in your forms has a valid accessible name or linked label.

Fix

Add a <label> element with a for attribute that matches the id of the <select> tag.

Explain

Explain how accessible names for select elements provide the necessary context for users of assistive technologies.

Code Review

Review the rendered markup and interactive states that affect Provide accessible names for select elements. 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/select-name

常见问题

下拉菜单为什么需要标签?

没有标签,屏幕阅读器用户就无法知道下拉菜单要求提供什么信息,表单可能根本无法完成。

把第一个选项作为标签好吗?

不好。这个技能说,不应用第一个选项来代替正确的标签。

什么时候使用 aria-label?

这个技能建议在无法显示可见标签时使用它。

详情

作者的原始描述

Use when reviewing rendered HTML, interactive components, or design-system patterns related to Provide accessible names for select elements. 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
排名
#3012
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能