AGENT SKILL
键盘焦点顺序审计
wcag-audit-operable-keyboard-focus
验证界面元素是否符合逻辑键盘导航顺序。
- License 许可
- MIT
- 最近更新
- 2026-01-19
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- wcag-audit-operable-keyboard-focus
- description
- Validate logical keyboard navigation order for interface elements
02 资源文件 1
- 脚本scripts/validate.js7.6 KB
03 SKILL.md 正文
When to Use
Use this tool when designing keyboard navigation flows, testing tab order, or ensuring logical focus progression through interactive elements.
Usage
Command Line
node scripts/validate.js --elements "header, nav, main, button, button, footer"
node scripts/validate.js --tab-order "1,2,3,4,5" --expected "1,2,3,4,5"
node scripts/validate.js --json '{"elements": ["header", "nav", "main", "button#submit"], "tabOrder": [1,2,3,4]}'
JSON Input
node scripts/validate.js --json '{
"elements": ["header", "nav", "button#menu", "main", "button#submit", "footer"],
"tabOrder": [1, 2, 3, 4, 5, 6],
"expectedOrder": [1, 2, 4, 5, 3, 6]
}'
Parameters
--elements: Comma-separated list of element identifiers--tab-order: Comma-separated list of tab order indices--expected: Expected logical order (optional)--json: JSON input with elements and tab order properties
Output
Returns JSON with validation results and issues:
{
"elements": ["header", "nav", "main", "button", "footer"],
"tabOrder": [1, 2, 3, 4, 5],
"validation": {
"logical": true,
"complete": true,
"issues": []
},
"recommendations": [
"Consider moving primary action button before secondary navigation"
]
}
Examples
Validate simple tab order
$ node scripts/validate.js --elements "header, nav, main, button, footer" --tab-order "1,2,3,4,5"
✅ Logical order: PASS
✅ Complete coverage: PASS
✅ No focus traps: PASS
Focus order follows logical reading sequence
Detect focus order issues
$ node scripts/validate.js --elements "header, nav, button, main, footer" --tab-order "1,2,4,3,5"
❌ Logical order: FAIL
⚠️ Tab order issue: "main" (position 3) appears before "button" (position 4)
Recommendations:
- Move main content before secondary buttons
- Consider semantic HTML structure for better default tab order
WCAG Standards
- Logical Order: Focus order should follow logical reading sequence
- No Traps: Users should not get trapped in focus loops
- Complete Coverage: All interactive elements should be keyboard accessible
- Skip Links: Provide mechanisms to skip repeated navigation sections
- Modal Focus: Modal dialogs should manage focus appropriately
Best Practices
- Follow reading order: Tab order should match visual reading sequence
- Use semantic HTML: Proper heading hierarchy and landmarks improve default tab order
- Provide skip links: Allow users to skip navigation sections
- Test with keyboard: Verify all interactions work without mouse
- Avoid focus traps: Ensure users can always move forward and backward
Focus Order Patterns
Good Order:
- Header/Skip links
- Main navigation
- Main content
- Footer links
- Footer
Problematic Order:
- Header
- Footer links
- Main navigation
- Main content
Learn More
For more information about Agent Skills and how they extend AI capabilities.
04 同仓库更多 Skills
表单输入无障碍审计
wcag-audit-understandable-forms
路由表单输入与数据收集的无障碍需求
★ 1
表单设计无障碍深度审计
wcag-audit-understandable-forms-deep
面向用户输入与数据收集的表单设计无障碍规则
★ 1
文本排版无障碍设计审计
wcag-audit-perceivable-text
路由排版无障碍设计决策与需求
★ 1
字体单位无障碍换算
wcag-audit-perceivable-text-size
结合无障碍上下文,在 px、pt、em、rem 单位之间进行转换
★ 1
文本排版无障碍深度审计
wcag-audit-perceivable-text-deep
面向文本设计与可读性的全面排版无障碍规则
★ 1
音视频多媒体无障碍审计
wcag-audit-perceivable-media
路由音频、视频和多媒体无障碍需求
★ 1