Communitygithub.com

無障礙設計 (WCAG 2.2)

使用 WCAG 2.2 Level AA 標準設計、實作與稽核包容性的數位產品。適用於建置或審查需要符合 WCAG 2.2 Level AA 的使用者介面,或是檢查鍵盤、對比度、螢幕閱讀器支援的變更。

無障礙設計 (WCAG 2.2) 是什麼?

此技能確保數位介面對所有使用者(包括使用螢幕閱讀器、切換控制或鍵盤導航者)皆可感知、可操作、可理解且穩固(POUR)。它專注於 WCAG 2.2 成功標準的技術實作,涵蓋語義映射、焦點管理、標籤與提示等核心概念。此技能支援 Web、iOS 與 Android 平台,並提供跨平台屬性對照表(例如 Web 的 ARIA、iOS 的 SwiftUI、Android 的 Compose)。透過逐步指南(識別角色、定義可感知屬性、實作可操作控制、確保可理解邏輯、驗證穩固相容性)與反模式提醒,幫助開發者避免常見的無障礙錯誤,並遵循最佳實務檢查清單。

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/accessibility

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

無障礙設計 (WCAG 2.2) 是做什麼的?

此技能確保數位介面對所有使用者(包括使用螢幕閱讀器、切換控制或鍵盤導航者)皆可感知、可操作、可理解且穩固(POUR)。它專注於 WCAG 2.2 成功標準的技術實作。

使用時機

  • 定義 Web、iOS 或 Android 的 UI 元件規格。
  • 稽核現有程式碼以找出無障礙障礙或合規差距。
  • 實作新的 WCAG 2.2 標準,例如目標尺寸(最小)和焦點外觀。
  • 將高層次的設計需求轉換為技術屬性(ARIA 角色、特質、提示)。

核心概念

  • POUR 原則:WCAG 的基礎(可感知、可操作、可理解、穩固)。
  • 語義映射:使用原生元素而非通用容器,以提供內建的無障礙支援。
  • 無障礙樹:輔助技術實際「讀取」的 UI 表示。
  • 焦點管理:控制鍵盤/螢幕閱讀器游標的順序與可見性。
  • 標籤與提示:透過 aria-label、accessibilityLabel 和 contentDescription 提供上下文。

運作方式

步驟 1:識別元件角色

判斷功能用途(例如,這是按鈕、連結還是頁籤?)。在訴諸自訂角色之前,盡可能使用最語義化的原生元素。

步驟 2:定義可感知屬性

  • 確保文字對比度達到 4.5:1(一般文字)或 3:1(大字型/UI 元件)。
  • 為非文字內容(圖片、圖示)加入文字替代方案。
  • 實作回應式重新排版(最多放大至 400% 而不損失功能)。

步驟 3:實作可操作控制

  • 確保最小 24x24 CSS 像素的目標尺寸(WCAG 2.2 SC 2.5.8)。
  • 確認所有可互動元素皆可透過鍵盤觸及,並具有可見的焦點指示器(SC 2.4.11)。
  • 為拖曳動作提供單一指標替代方案。

步驟 4:確保可理解邏輯

  • 使用一致的導航模式。
  • 提供描述性的錯誤訊息與修正建議(SC 3.3.3)。
  • 實作「重複輸入」(SC 3.3.7),避免要求使用者重複輸入相同資料。

步驟 5:驗證穩固相容性

  • 使用正確的「名稱、角色、值」模式。
  • 為動態狀態更新實作 aria-live 或即時區域(live regions)。

無障礙架構圖

flowchart TD
  UI["UI 元件"] --> Platform{平台?}
  Platform -->|Web| ARIA["WAI-ARIA + HTML5"]
  Platform -->|iOS| SwiftUI["無障礙特質 + 標籤"]
  Platform -->|Android| Compose["語義 + ContentDesc"]

  ARIA --> AT["輔助技術(螢幕閱讀器、切換控制)"]
  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">搜尋產品</label>
  <input type="search" id="search-input" placeholder="搜尋..." />
  <button type="submit" aria-label="提交搜尋">
    <svg aria-hidden="true">...</svg>
  </button>
</form>

iOS:無障礙動作按鈕

Button(action: deleteItem) {
    Image(systemName: "trash")
}
.accessibilityLabel("刪除項目")
.accessibilityHint("從列表中永久移除這個項目")
.accessibilityAddTraits(.isButton)

Android:無障礙切換開關

Switch(
    checked = isEnabled,
    onCheckedChange = { onToggle() },
    modifier = Modifier.semantics {
        contentDescription = "啟用通知"
    }
)

應避免的反模式

  • Div 按鈕:使用 <div> 或 <span> 處理點擊事件,卻未加入角色和鍵盤支援。
  • 僅靠顏色表達意義:只透過顏色變化(例如將邊框變紅)來表示錯誤或狀態。
  • 未封閉的模態框焦點:模態框未能限制焦點,導致鍵盤使用者在模態框開啟時能操作背景內容。焦點必須被限制在模態框內,並且可以透過 Escape 鍵或明確的關閉按鈕來逃脫(WCAG SC 2.1.2)。
  • 冗餘的替代文字:在替代文字中使用「圖片...」或「照片...」(螢幕閱讀器已會宣告「圖片」角色)。

最佳實務檢查清單

  • 可互動元件達到 24x24px(Web)或 44x44pt(原生)的目標尺寸。
  • 焦點指示器清晰可見且具有高對比度。
  • 模態框在開啟時限制焦點,並在關閉時乾淨釋放(Escape 鍵或關閉按鈕)。
  • 下拉選單和彈出選單在關閉時將焦點恢復到觸發元素。
  • 表單提供基於文字的錯誤建議。
  • 所有僅含圖示的按鈕都有描述性的文字標籤。
  • 文字縮放時,內容能正確重新排版。

參考資料

相關技能

  • frontend-patterns
  • design-system
  • liquid-glass-design
  • swiftui-patterns

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

api-connector-builder

Build a new API connector or provider by matching the target repo

相關技能