accessible-tooltips
它能做什么
这项技能检查工具提示能否被键盘和屏幕阅读器用户触达并读取。适合在按钮或图标上放置帮助提示的网页团队。
适用场景
- ✓当你构建的工具提示会在访客悬停于按钮或图标上时出现时。
- ✓当提示只有鼠标用户能看到,键盘用户却看不到时。
- ✓当你在审查共享工具提示组件的无障碍性时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/accessible-tooltips/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我设置页面上的帮助工具提示,是否能用键盘和屏幕阅读器正常使用。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查标记中是否有可获得焦点的触发元素、正确的 tooltip 角色、触发元素与提示之间的关联,以及是否可以用 Escape 键关闭。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Create accessible tooltips
Inaccessible tooltips leave keyboard and screen reader users without important contextual information, creating an unequal experience and potential confusion.
Quick Reference
- Tooltips must be keyboard accessible (focusable trigger)
- Use aria-describedby to associate tooltip with trigger
- Allow hover and focus to show tooltip, Escape to dismiss
- Ensure sufficient contrast and don't hide essential info in tooltips
Check
Verify tooltips are keyboard accessible, use appropriate ARIA roles (tooltip), and can be dismissed without moving focus.
Fix
Implement tooltips with role='tooltip', aria-describedby, keyboard triggering, and Escape key dismissal.
Explain
Explain the accessibility requirements for tooltips including keyboard access, ARIA attributes, and timing considerations.
Code Review
Review templates, server-rendered HTML, and shared components that output markup related to Create accessible tooltips. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/html/accessible-tooltips
常见问题
为什么工具提示可能给键盘用户带来问题?
如果触发元素无法获得焦点,或提示只在悬停时显示,键盘用户就永远看不到这些额外信息。
工具提示应该包含关键信息吗?
不应该。这项技能说明,重要的细节不应只放在工具提示中。
这里 aria-describedby 有什么作用?
它把触发元素与提示文字关联起来,使屏幕阅读器能够读出这条提示。
详情
作者的原始描述
Use when reviewing templates, rendered HTML, or shared components related to Create accessible tooltips. Validate the final browser-facing markup, not just the source framework abstraction.
热度
- GitHub 星标
- 75k
- 排名
- #2712
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。