accessibility
它能做什么
这个工具可以帮助你确保网站和应用对所有人都容易使用,包括有视力或运动障碍的用户。它会检查屏幕上的元素是否清晰、可操作,以及是否兼容屏幕阅读器。
适用场景
- ✓在构建新的网站或应用时。
- ✓在检查现有的网站或应用时。
- ✓当你想确保每个人都能使用你的数字产品时。
技能链接
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/accessibility/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查这个“保存”按钮对键盘用户来说是否可以访问。”
每周 5 个新技能,1 分钟读完。
工作原理
它会分析按钮、链接等交互元素是如何被描述的,以及用户如何在它们之间切换。它还会确保颜色、尺寸和交互方式与辅助技术配合良好。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Accessibility (WCAG 2.2)
This skill ensures that digital interfaces are Perceivable, Operable, Understandable, and Robust (POUR) for all users, including those using screen readers, switch controls, or keyboard navigation. It focuses on the technical implementation of WCAG 2.2 success criteria.
When to Use
- Defining UI component specifications for Web, iOS, or Android.
- Auditing existing code for accessibility barriers or compliance gaps.
- Implementing new WCAG 2.2 standards like Target Size (Minimum) and Focus Appearance.
- Mapping high-level design requirements to technical attributes (ARIA roles, traits, hints).
Core Concepts
- POUR Principles: The foundation of WCAG (Perceivable, Operable, Understandable, Robust).
- Semantic Mapping: Using native elements over generic containers to provide built-in accessibility.
- Accessibility Tree: The representation of the UI that assistive technologies actually "read."
- Focus Management: Controlling the order and visibility of the keyboard/screen reader cursor.
- Labeling & Hints: Providing context through
aria-label,accessibilityLabel, andcontentDescription.
How It Works
Step 1: Identify the Component Role
Determine the functional purpose (e.g., Is this a button, a link, or a tab?). Use the most semantic native element available before resorting to custom roles.
Step 2: Define Perceivable Attributes
- Ensure text contrast meets 4.5:1 (normal) or 3:1 (large/UI).
- Add text alternatives for non-text content (images, icons).
- Implement responsive reflow (up to 400% zoom without loss of function).
Step 3: Implement Operable Controls
- Ensure a minimum 24x24 CSS pixel target size (WCAG 2.2 SC 2.5.8).
- Verify all interactive elements are reachable via keyboard and have a visible focus indicator (SC 2.4.11).
- Provide single-pointer alternatives for dragging movements.
Step 4: Ensure Understandable Logic
- Use consistent navigation patterns.
- Provide descriptive error messages and suggestions for correction (SC 3.3.3).
- Implement "Redundant Entry" (SC 3.3.7) to prevent asking for the same data twice.
Step 5: Verify Robust Compatibility
- Use correct
Name, Role, Valuepatterns. - Implement
aria-liveor live regions for dynamic status updates.
Accessibility Architecture Diagram
flowchart TD
UI["UI Component"] --> Platform{Platform?}
Platform -->|Web| ARIA["WAI-ARIA + HTML5"]
Platform -->|iOS| SwiftUI["Accessibility Traits + Labels"]
Platform -->|Android| Compose["Semantics + ContentDesc"]
ARIA --> AT["Assistive Technology (Screen Readers, Switches)"]
SwiftUI --> AT
Compose --> AT
Cross-Platform Mapping
| Feature | Web (HTML/ARIA) | iOS (SwiftUI) | Android (Compose) |
|---|---|---|---|
| Primary Label | aria-label / <label> |
.accessibilityLabel() |
contentDescription |
| Secondary Hint | aria-describedby |
.accessibilityHint() |
Modifier.semantics { stateDescription = ... } |
| Action Role | role="button" |
.accessibilityAddTraits(.isButton) |
Modifier.semantics { role = Role.Button } |
| Live Updates | aria-live="polite" |
.accessibilityLiveRegion(.polite) |
Modifier.semantics { liveRegion = LiveRegionMode.Polite } |
Examples
Web: Accessible Search
<form role="search">
<label for="search-input" class="sr-only">Search products</label>
<input type="search" id="search-input" placeholder="Search..." />
<button type="submit" aria-label="Submit Search">
<svg aria-hidden="true">...</svg>
</button>
</form>
iOS: Accessible Action Button
Button(action: deleteItem) {
Image(systemName: "trash")
}
.accessibilityLabel("Delete item")
.accessibilityHint("Permanently removes this item from your list")
.accessibilityAddTraits(.isButton)
Android: Accessible Toggle
Switch(
checked = isEnabled,
onCheckedChange = { onToggle() },
modifier = Modifier.semantics {
contentDescription = "Enable notifications"
}
)
Anti-Patterns to Avoid
…
常见问题
什么是“POUR 原则”?
这是实现无障碍设计的基础,包括:可感知(Perceivable,信息能被看到)、可操作(Operable,用户能与之交互)、可理解(Understandable,信息清晰易懂)和健壮(Robust,能在不同技术下正常工作)。
什么是“焦点”?
焦点是屏幕上当前被选中的元素,键盘或屏幕阅读器的指令都会作用于它。焦点需要清晰可见,并且便于操作。
为什么按钮的最小尺寸很重要?
太小的按钮很难点击或触摸,对于有运动障碍的人或使用小屏幕的人来说尤其如此。设定最小尺寸可以确保按钮容易操作。
详情
作者的原始描述
Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels, accessibility traits and hints, focus management, contrast, target size, and screen-reader support. Use when building or auditing UI for accessibility compliance, keyboard navigation, or screen-reader support.
repo: affaan-m/ECC
热度
- GitHub 星标
- 280k
- 排名
- #126
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
agent-architecture-audit
280k让你的智能体检查一切是否正常运行。它能找出并修复 AI 系统中的问题,确保系统按预期工作。
agent-eval
280k帮你的智能体比较不同的 AI 编程工具。它能衡量哪个工具在特定任务上更快、更便宜、更可靠。
agent-harness-construction
280k让你的智能体更好地理解如何完成任务。它会优化智能体使用的工具和指令,提高成功的几率。
agent-introspection-debugging
280k帮你的智能体在出错时自我修复。它会排查失败的原因并找到解决方案,而不是简单地重试。