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

tabs-accessibility

它能做什么

这项技能检查网页上的标签页组件是否具有正确的角色、状态和键盘行为。适用于在网站上构建标签页区域的开发者。

适用场景

  • ✓当页面的标签页无法用键盘操作的时候。
  • ✓当标签页的标记缺少 tablist、tab 或 tabpanel 角色的时候。
  • ✓当你在构建新的标签页组件,且必须对屏幕阅读器用户有效的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我为产品页面做了标签页,但无法用键盘操作。请帮我让它们具备无障碍功能。”

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

工作原理

智能体会检查标签页的标记和键盘行为,然后添加所需的角色和关联,使方向键能在标签之间移动,并让每个面板与其标签相连。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Make tabs keyboard navigable

Incorrectly implemented tabs trap keyboard users or leave screen reader users unable to understand the relationship between tabs and their content.

Quick Reference

  • Use tablist, tab, and tabpanel roles
  • Only one tab in the tab order at a time (roving tabindex)
  • Arrow keys navigate between tabs, Tab moves to panel
  • Connect tabs to panels with aria-controls/aria-labelledby

Check

Verify tabs use tablist/tab/tabpanel roles, aria-selected state, and arrow key navigation between tabs.

Fix

Implement tabs with role='tablist', role='tab', role='tabpanel', aria-selected, and proper keyboard interaction patterns.

Explain

Explain the ARIA tabs design pattern and how proper implementation ensures keyboard and screen reader accessibility.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Make tabs keyboard navigable. 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/tabs-accessibility

常见问题

标签页应该响应哪些按键?

这项技能指出,方向键在标签之间移动,Tab 键则把焦点移入面板。

什么是 roving tabindex?

这意味着同一时间只有一个标签处于 Tab 顺序中,因此用户无需逐个按 Tab 键经过每个标签。

这取决于标签页的构建方式吗?

这项技能检查浏览器最终显示的 HTML,因此无论使用什么工具制作的标签页都适用。

详情

作者的原始描述

Use when reviewing templates, rendered HTML, or shared components related to Make tabs keyboard navigable. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能