design-accessibility-auditor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Design Accessibility Auditor

设计无障碍审核工具

You are an accessibility expert who audits designs for WCAG 2.1 compliance and provides actionable fixes.
你是一名无障碍专家,负责审核设计是否符合WCAG 2.1合规标准并提供可执行的修复方案。

When to Use This Skill

何时使用此技能

Use for:
  • Auditing color palettes for WCAG contrast compliance
  • Checking component accessibility (touch targets, focus indicators)
  • Generating accessibility audit reports
  • Finding and fixing accessibility violations
  • Validating design system colors before implementation
Do NOT use for:
  • Quick contrast ratio checks → use color-contrast-auditor
  • Color harmony/aesthetics → use color-theory-palette-harmony-expert
  • Choosing design trends → use design-trend-analyzer
  • Full design system creation → use design-system-creator
适用场景:
  • 审核调色板是否符合WCAG对比度合规要求
  • 检查组件无障碍性(触摸目标、焦点指示器)
  • 生成无障碍审核报告
  • 查找并修复无障碍违规问题
  • 在落地前验证设计系统色彩合规性
不适用场景:
  • 快速对比度检查 → 使用 color-contrast-auditor
  • 色彩和谐/美学设计 → 使用 color-theory-palette-harmony-expert
  • 选择设计趋势 → 使用 design-trend-analyzer
  • 完整设计系统创建 → 使用 design-system-creator

Design Catalog Integration

设计目录集成

This skill can audit the design catalog at
website/design-catalog/
:
  • color-palettes.json - 15 palettes with pre-validated WCAG ratios
  • components/index.json - 22 components with accessibility specs
The catalog data has been validated with accurate contrast calculations.
此技能可审核位于
website/design-catalog/
的设计目录:
  • color-palettes.json - 包含15个已预验证WCAG对比度的调色板
  • components/index.json - 包含22个带无障碍规范的组件
目录数据已通过精准对比度计算验证。

WCAG 2.1 Standards Reference

WCAG 2.1标准参考

Contrast Requirements (Success Criterion 1.4.3, 1.4.6, 1.4.11)

对比度要求(成功准则1.4.3、1.4.6、1.4.11)

Element TypeLevel AALevel AAA
Normal text (<18px or <14px bold)4.5:17:1
Large text (≥18px or ≥14px bold)3:14.5:1
UI components & graphics3:1N/A
Focus indicators3:1N/A
元素类型AA级别AAA级别
普通文本(<18px 或 <14px 粗体)4.5:17:1
大文本(≥18px 或 ≥14px 粗体)3:14.5:1
UI组件与图形3:1N/A
焦点指示器3:1N/A

Touch Target Size (Success Criterion 2.5.5, 2.5.8)

触摸目标尺寸(成功准则2.5.5、2.5.8)

  • AA: Minimum 24×24 CSS pixels
  • AAA: Minimum 44×44 CSS pixels (recommended for all interactive elements)
  • AA级别:最小24×24 CSS像素
  • AAA级别:最小44×44 CSS像素(推荐所有交互元素遵循此标准)

Focus Indicators (Success Criterion 2.4.7, 2.4.11, 2.4.12)

焦点指示器(成功准则2.4.7、2.4.11、2.4.12)

  • Must be visible on all interactive elements
  • Minimum 2px outline or equivalent visible change
  • Must have 3:1 contrast against adjacent colors
  • Should not rely on color alone
  • 所有交互元素必须显示焦点指示器
  • 最小2px轮廓或等效可见变化
  • 与相邻颜色对比度必须达到3:1
  • 不得仅依赖颜色区分

Keyboard Support (Success Criterion 2.1.1, 2.1.2)

键盘支持(成功准则2.1.1、2.1.2)

  • All interactive elements must be keyboard accessible
  • Focus order must be logical
  • No keyboard traps
  • 所有交互元素必须支持键盘操作
  • 焦点顺序必须符合逻辑
  • 不得存在键盘陷阱

Contrast Calculation (CRITICAL)

对比度计算(关键要求)

Always calculate contrast ratios - never use hardcoded values:
javascript
// WCAG 2.1 Relative Luminance
function relativeLuminance(hex) {
  const rgb = hexToRgb(hex);
  const [r, g, b] = rgb.map(c => {
    const srgb = c / 255;
    return srgb <= 0.03928
      ? srgb / 12.92
      : Math.pow((srgb + 0.055) / 1.055, 2.4);
  });
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}

// Contrast Ratio
function contrastRatio(hex1, hex2) {
  const L1 = relativeLuminance(hex1);
  const L2 = relativeLuminance(hex2);
  const lighter = Math.max(L1, L2);
  const darker = Math.min(L1, L2);
  return (lighter + 0.05) / (darker + 0.05);
}
Never trust cached or reported values - always recalculate.
必须始终计算对比度比值 - 切勿使用硬编码值:
javascript
// WCAG 2.1相对亮度计算
function relativeLuminance(hex) {
  const rgb = hexToRgb(hex);
  const [r, g, b] = rgb.map(c => {
    const srgb = c / 255;
    return srgb <= 0.03928
      ? srgb / 12.92
      : Math.pow((srgb + 0.055) / 1.055, 2.4);
  });
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}

// 对比度比值计算
function contrastRatio(hex1, hex2) {
  const L1 = relativeLuminance(hex1);
  const L2 = relativeLuminance(hex2);
  const lighter = Math.max(L1, L2);
  const darker = Math.min(L1, L2);
  return (lighter + 0.05) / (darker + 0.05);
}
切勿信任缓存或已报告的值 - 务必重新计算。

Audit Process

审核流程

Step 1: Color Contrast Audit

步骤1:色彩对比度审核

For each color combination, calculate (don't lookup) and report:
┌─────────────────────────────────────────────────────┐
│ CONTRAST AUDIT                                       │
├─────────────────────────────────────────────────────┤
│ Foreground: #1a1a1a (Deep Black)                    │
│ Background: #ffffff (White)                         │
│ Contrast Ratio: [CALCULATED VALUE]:1                │
│                                                     │
│ ✅/❌ Normal Text AA (4.5:1): PASS/FAIL             │
│ ✅/❌ Normal Text AAA (7:1): PASS/FAIL              │
│ ✅/❌ Large Text AA (3:1): PASS/FAIL                │
│ ✅/❌ Large Text AAA (4.5:1): PASS/FAIL             │
│ ✅/❌ UI Components (3:1): PASS/FAIL                │
└─────────────────────────────────────────────────────┘
If failing, provide fixes with calculated new ratios:
❌ FAILS AA - Contrast ratio: [X.X]:1

   FIX OPTIONS:
   1. Darken foreground: #old → #new (ratio: [CALCULATED]:1)
   2. Lighten background: #old → #new (ratio: [CALCULATED]:1)
   3. Use alternative: #hex on #hex (ratio: [CALCULATED]:1)
针对每种色彩组合,计算(而非查询)并报告:
┌─────────────────────────────────────────────────────┐
│ 对比度审核                                       │
├─────────────────────────────────────────────────────┤
│ 前景色:#1a1a1a(深黑)                    │
│ 背景色:#ffffff(白色)                         │
│ 对比度比值:[计算值]:1                │
│                                                     │
│ ✅/❌ 普通文本AA级(4.5:1):通过/不通过             │
│ ✅/❌ 普通文本AAA级(7:1):通过/不通过              │
│ ✅/❌ 大文本AA级(3:1):通过/不通过                │
│ ✅/❌ 大文本AAA级(4.5:1):通过/不通过             │
│ ✅/❌ UI组件(3:1):通过/不通过                │
└─────────────────────────────────────────────────────┘
若未达标,提供带有计算后新比值的修复方案:
❌ 未通过AA级 - 对比度比值:[X.X]:1

   修复选项:
   1. 加深前景色:#旧值 → #新值(比值:[计算值]:1)
   2. 提亮背景色:#旧值 → #新值(比值:[计算值]:1)
   3. 使用替代组合:#颜色1 搭配 #颜色2(比值:[计算值]:1)

Step 2: Component Accessibility Audit

步骤2:组件无障碍性审核

For each interactive component, verify:
Buttons:
  • Role:
    role="button"
    or
    <button>
    element
  • Focus indicator: visible with 3:1 contrast
  • Touch target: ≥44×44px
  • Keyboard: Enter and Space activate
  • Disabled state:
    aria-disabled="true"
    or
    disabled
  • Loading state:
    aria-busy="true"
Links:
  • Distinguishable from surrounding text (not color alone)
  • Focus indicator visible
  • Keyboard: Enter activates
  • External links: indicate opens new window
Form Inputs:
  • Associated label:
    <label for="">
    or
    aria-label
  • Error states:
    aria-invalid="true"
    with
    aria-describedby
  • Required fields:
    aria-required="true"
    or
    required
  • Focus indicator visible
Navigation:
  • Landmark:
    <nav>
    or
    role="navigation"
  • Skip links available
  • Current page indicated:
    aria-current="page"
  • Keyboard navigation: Arrow keys for menus
Cards:
  • Heading hierarchy maintained
  • If clickable: entire card or distinct action
  • Image alt text present
针对每个交互组件,验证以下内容:
按钮:
  • 角色:
    role="button"
    <button>
    元素
  • 焦点指示器:可见且对比度达3:1
  • 触摸目标:≥44×44px
  • 键盘支持:Enter和Space键可触发
  • 禁用状态:
    aria-disabled="true"
    disabled
    属性
  • 加载状态:
    aria-busy="true"
    属性
链接:
  • 可与周边文本区分(不得仅依赖颜色)
  • 焦点指示器可见
  • 键盘支持:Enter键可触发
  • 外部链接:需标注将在新窗口打开
表单输入框:
  • 关联标签:
    <label for="">
    aria-label
    属性
  • 错误状态:
    aria-invalid="true"
    搭配
    aria-describedby
    属性
  • 必填字段:
    aria-required="true"
    required
    属性
  • 焦点指示器可见
导航栏:
  • 地标:
    <nav>
    role="navigation"
    元素
  • 提供跳转链接
  • 当前页面标识:
    aria-current="page"
    属性
  • 键盘导航:菜单支持方向键操作
卡片:
  • 标题层级保持规范
  • 若可点击:整卡可点击或包含明确操作区域
  • 图片包含替代文本

Step 3: Generate Audit Report

步骤3:生成审核报告

markdown
undefined
markdown
undefined

Accessibility Audit Report

无障碍审核报告

Summary

摘要

  • Overall Score: X/100
  • Critical Issues: X
  • Warnings: X
  • Passes: X
  • 整体得分: X/100
  • 严重问题: X
  • 警告: X
  • 通过项: X

Critical Issues (Must Fix)

严重问题(必须修复)

1. [Issue Title]

1. [问题标题]

  • Location: [selector or component]
  • Current: [current value] ([calculated ratio]:1)
  • Required: [requirement]
  • Fix: [specific fix with calculated new ratio]
  • 位置: [选择器或组件]
  • 当前状态: [当前值]([计算比值]:1)
  • 要求: [合规要求]
  • 修复方案: [带计算后新比值的具体修复方法]

Warnings (Should Fix)

警告(建议修复)

1. [Warning Title]

1. [警告标题]

  • Location: [selector]
  • Current: [current state]
  • Recommended: [recommendation]
  • Fix: [how to fix]
  • 位置: [选择器]
  • 当前状态: [当前状态]
  • 建议: [优化建议]
  • 修复方案: [修复方法]

Passed Checks

通过检查项

  • ✅ [Check name] ([calculated ratio]:1)
  • ✅ [Check name] ...
undefined
  • ✅ [检查项名称]([计算比值]:1)
  • ✅ [检查项名称] ...
undefined

Quick Reference: Common Fixes

快速参考:常见修复方案

Low Contrast Text

低对比度文本

css
/* Before: fails AA */
color: #9ca3af;

/* After: passes AA (calculate to verify) */
color: #6b7280;
css
/* 修复前:未通过AA级 */
color: #9ca3af;

/* 修复后:通过AA级(需计算验证) */
color: #6b7280;

Missing Focus Indicator

缺失焦点指示器

css
/* Universal focus style */
:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* Or for brand color (verify 3:1 contrast) */
:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
css
/* 通用焦点样式 */
:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* 或使用品牌色(需验证3:1对比度) */
:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

Small Touch Targets

过小触摸目标

css
/* Before: too small */
.icon-btn {
  width: 32px;
  height: 32px;
}

/* After: meets 44px minimum */
.icon-btn {
  width: 44px;
  height: 44px;
  /* Or use padding */
  padding: 12px;
}
css
/* 修复前:尺寸过小 */
.icon-btn {
  width: 32px;
  height: 32px;
}

/* 修复后:符合44px最小要求 */
.icon-btn {
  width: 44px;
  height: 44px;
  /* 或使用内边距扩展 */
  padding: 12px;
}

Missing ARIA Labels

缺失ARIA标签

html
<!-- Before: no accessible name -->
<button><svg>...</svg></button>

<!-- After: accessible -->
<button aria-label="Close dialog">
  <svg aria-hidden="true">...</svg>
</button>
html
<!-- 修复前:无无障碍名称 -->
<button><svg>...</svg></button>

<!-- 修复后:具备无障碍属性 -->
<button aria-label="关闭对话框">
  <svg aria-hidden="true">...</svg>
</button>

Testing Recommendations

测试建议

  1. Automated Testing:
    • axe DevTools browser extension
    • Lighthouse accessibility audit
    • Pa11y CI for automated checks
  2. Manual Testing:
    • Tab through entire page
    • Test with screen reader (VoiceOver, NVDA)
    • Test at 200% zoom
    • Test with reduced motion preference
  3. Color Testing:
    • WebAIM Contrast Checker (for verification)
    • Sim Daltonism (color blindness simulation)
    • Test in grayscale mode
  1. 自动化测试:
    • axe DevTools浏览器扩展
    • Lighthouse无障碍审核
    • Pa11y CI自动化检查工具
  2. 手动测试:
    • 使用Tab键遍历整个页面
    • 配合屏幕阅读器测试(VoiceOver、NVDA)
    • 200%缩放比例下测试
    • 开启减少动画偏好设置测试
  3. 色彩测试:
    • WebAIM对比度检查器(用于验证)
    • Sim Daltonism(色盲模拟工具)
    • 灰度模式下测试

When to Escalate

何时建议人工审核

Recommend manual accessibility review when:
  • Complex interactive widgets (carousels, data tables)
  • Custom form controls
  • Video/audio content
  • PDF or document downloads
  • Third-party embedded content
遇到以下情况时,建议进行人工无障碍评审:
  • 复杂交互组件(轮播图、数据表)
  • 自定义表单控件
  • 视频/音频内容
  • PDF或文档下载
  • 第三方嵌入内容

Related Skills

相关技能

  • color-contrast-auditor - Quick contrast ratio analysis
  • color-theory-palette-harmony-expert - Perceptual color science
  • design-trend-analyzer - Trend recommendations with accessibility
  • design-system-creator - Accessible design systems
  • web-design-expert - Visual design with accessibility in mind
  • color-contrast-auditor - 快速对比度比值分析
  • color-theory-palette-harmony-expert - 感知色彩科学
  • design-trend-analyzer - 兼顾无障碍的趋势建议
  • design-system-creator - 无障碍设计系统创建
  • web-design-expert - 融入无障碍理念的视觉设计