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

button-name

它能做什么

这项技能检查页面上所有按钮是否都有描述性名称。适合用图标或自定义控件构建按钮的开发者。

适用场景

  • ✓当你添加仅有图标的按钮,例如关闭或搜索图标时。
  • ✓当屏幕阅读器只把某个按钮读成“按钮”时。
  • ✓当链接跳转到新页面,却被设计成按钮的样式时。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请确保我网站页眉中的每个图标按钮都有屏幕阅读器可以读出的名称。”

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

工作原理

智能体会检查每个按钮是否有可见文字、aria-label 或 aria-labelledby,并把只用于跳转的按钮替换为正确的链接。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Provide accessible names for buttons

Buttons without accessible names are announced as 'button' by screen readers, leaving users unable to determine what action will be triggered.

Quick Reference

  • Ensure every <button> has a discernible, descriptive label
  • Use inner text, aria-label, or aria-labelledby for identification
  • Use buttons for actions and state changes, not page navigation
  • Avoid empty buttons or those containing only non-text icons

Check

Scan for buttons that lack descriptive text or accessible labels.

Fix

Add an accessible name to the button using text content, an aria-label, or an aria-labelledby reference. If the element navigates to another URL, replace the button with a link instead of keeping button semantics.

Explain

Explain why accessible names are critical for screen reader users to identify and interact with buttons, and why buttons should trigger actions while links should handle navigation.

Code Review

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

常见问题

没有名称的按钮有什么问题?

这项技能说明,屏幕阅读器只会读出“按钮”,用户无法知道会发生什么。

什么时候应该改用链接?

这项技能说明,如果元素会跳转到另一个网址,就应使用链接,而不是按钮语义。

按钮可以使用哪些名称?

内部文字、aria-label 或 aria-labelledby。

详情

作者的原始描述

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能