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

accessible-tooltips

它能做什么

这项技能检查工具提示能否被键盘和屏幕阅读器用户触达并读取。适合在按钮或图标上放置帮助提示的网页团队。

适用场景

  • ✓当你构建的工具提示会在访客悬停于按钮或图标上时出现时。
  • ✓当提示只有鼠标用户能看到,键盘用户却看不到时。
  • ✓当你在审查共享工具提示组件的无障碍性时。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

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

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能