Accessibility

From mturac/everything-openai-codex · View interactive version

Accessibility is an AI agent skill from the GitHub repository mturac/everything-openai-codex. 使用 WCAG 2.2 Level AA 标准设计、实施和审计包容性数字产品。运用此技能为 Web 生成语义 ARIA,并为 Web 和原生平台(iOS/Android)生成无障碍特性。

How to use this skill

Skill file

无障碍性(WCAG 2.2)

本技能确保数字界面对于所有用户(包括使用屏幕阅读器、开关控制或键盘导航的用户)具有可感知性、可操作性、可理解性和健壮性(POUR)。它专注于 WCAG 2.2 成功标准的技术实现。

使用时机

核心概念

工作原理

步骤 1:识别组件角色

确定功能目的(例如,这是按钮、链接还是标签页?)。在诉诸自定义角色之前,优先使用最语义化的原生元素。

步骤 2:定义可感知属性

步骤 3:实现可操作控件

步骤 4:确保可理解逻辑

步骤 5:验证健壮兼容性

无障碍架构图

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

跨平台映射

| 特性 | Web (HTML/ARIA) | iOS (SwiftUI) | Android (Compose) |

| :--------------- | :----------------------- | :----------------------------------- | :---------------------------------------------------------- |

| 主标签 | aria-label / <label> | .accessibilityLabel() | contentDescription |

| 辅助提示 | aria-describedby | .accessibilityHint() | Modifier.semantics { stateDescription = ... } |

| 操作角色 | role="button" | .accessibilityAddTraits(.isButton) | Modifier.semantics { role = Role.Button } |

| 实时更新 | aria-live="polite" | .accessibilityLiveRegion(.polite) | Modifier.semantics { liveRegion = LiveRegionMode.Polite } |

示例

Web:无障碍搜索

<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:无障碍操作按钮

Button(action: deleteItem) {
    Image(systemName: "trash")
}
.accessibilityLabel("Delete item")
.accessibilityHint("Permanently removes this item from your list")
.accessibilityAddTraits(.isButton)

Android:无障碍切换开关

Switch(
    checked = isEnabled,
    onCheckedChange = { onToggle() },
    modifier = Modifier.semantics {
        contentDescription = "Enable notifications"
    }
)

应避免的反模式

最佳实践检查清单

参考

相关技能

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.