UI/UX Design
Domain: User interface design, user experience optimization, accessibility compliance, design systems
Applicable To: Web applications, VS Code extensions, mobile apps, desktop software
Skill Type: Systematic design audit, accessibility validation, design system implementation
Level 1: Quick Reference
Core Design Principles
Visual Hierarchy
- Typography scale: base size ≥11px for WCAG AA compliance
- Weight progression: 400 (regular) → 500 (medium) → 600 (semibold) → 700 (bold)
- Size jumps: ~2px increments (11px → 13px → 14px → 16px → 18px → 20px)
Spacing System
- Base unit: 4px or 8px (8px recommended for touch interfaces)
- Scale: base × 0.5, 1, 2, 3, 4, 6, 8, 12 (e.g., 4px, 8px, 16px, 24px, 32px, 48px, 64px, 96px)
- Consistency: All margins, padding, gaps use scale values
Color & Contrast
- WCAG AA minimum: 4.5:1 for normal text, 3:1 for large text (≥18px or ≥14px bold)
- WCAG AAA enhanced: 7:1 for normal text, 4.5:1 for large text
- Color-blind safety: Never rely on color alone (add icons, patterns, text labels)
Touch Targets
- Minimum size: 44×44px (WCAG 2.1 AA Level 2.5.5)
- Recommended: 48×48px for primary actions
- Spacing: Minimum 8px between adjacent targets
WCAG 2.1 AA Compliance Checklist
Perceivable
- ✓ Text alternatives (alt text, aria-label) for non-text content
- ✓ Color contrast ratio ≥4.5:1 for normal text, ≥3:1 for large text
- ✓ Text resizable up to 200% without loss of functionality
- ✓ No information conveyed by color alone
Operable
- ✓ All functionality available via keyboard (tabindex, focus management)
- ✓ Focus indicators visible (:focus-visible styles)
- ✓ Touch targets ≥44×44px
- ✓ No keyboard traps (can tab away from all interactive elements)
Understandable
- ✓ Semantic HTML (header, nav, main, article, aside, footer)
- ✓ ARIA roles for custom components (button, dialog, menu, tab, progressbar)
- ✓ Form labels associated with inputs (for/id or aria-labelledby)
- ✓ Error messages clear and actionable
Robust
- ✓ Valid HTML (no unclosed tags, proper nesting)
- ✓ ARIA attributes used correctly (aria-valuenow/min/max for progressbar)
- ✓ Compatible with assistive technologies (screen readers, keyboard-only)
Design System Quick Setup
CSS Variables Pattern
:root {
/* Typography Scale */
--font-xs: 11px; /* Minimum legal size */
--font-sm: 12px; /* Secondary text */
--font-md: 14px; /* Body text (VS Code default) */
--font-lg: 16px; /* Headings, emphasis */
--font-xl: 18px; /* Large headings */
/* Spacing Scale (8px base) */
--spacing-xs: 4px; /* Tight spacing */
--spacing-sm: 8px; /* Default gap */
--spacing-md: 16px; /* Section padding */
--spacing-lg: 24px; /* Card padding */
--spacing-xl: 32px; /* Page margins */
/* Theme-aware Colors */
--text-primary: var(--vscode-foreground);
--text-secondary: var(--vscode-descriptionForeground);
--bg-primary: var(--vscode-editor-background);
--bg-secondary: var(--vscode-sideBar-background);
--border-color: var(--vscode-panel-border);
--accent: var(--vscode-button-background);
}
Level 2: Detailed Practices
Systematic UI/UX Audit Process
Phase 1: Visual Assessment
Typography Audit
- Measure all font sizes (dev tools inspector)
- Flag sizes <11px (WCAG AA violation)
- Check line-height: 1.4-1.6 for body text
- Verify font-weight consistency (avoid random weights like 450, 550)
Spacing Audit
- Inspect margins/padding across components
- Identify spacing values (e.g., 7px, 13px, 21px = inconsistent)
- Calculate base unit: find GCD of all spacing values
- Normalize to scale (e.g., 13px → 12px or 16px)
Color Audit
- Screenshot all color combinations (text on background)
- Use contrast checker (WebAIM, Chrome DevTools)
- Document violations with severity:
- P0: <3:1 ratio (immediate fix)
- P1: 3:1-4.49:1 ratio (fails AA for normal text)
- P2: 4.5:1-6.99:1 ratio (passes AA, fails AAA)
Touch Target Audit
- Measure interactive elements (buttons, links, checkboxes)
- Flag elements <44px in either dimension
- Check spacing between adjacent targets (<8px = risk of mis-taps)
Phase 2: Accessibility Assessment
Keyboard Navigation Test
- Tab through entire interface
- Verify focus visible on all interactive elements
- Check focus order matches visual order
- Ensure no keyboard traps (can tab away from modals, menus)
Screen Reader Test
- Use NVDA (Windows), VoiceOver (Mac), or Narrator
- Verify all interactive elements have labels
- Check landmark regions announced (navigation, main, complementary)
- Confirm form fields have associated labels
Semantic HTML Audit
- Inspect DOM structure
- Replace
<div> buttons with <button> or role="button"
- Use
<nav>, <article>, <aside>, <section> for structure
- Add ARIA roles only when semantic HTML insufficient
Color-Blind Safety Test
- Use color-blindness simulator (Coblis, Chrome DevTools)
- Check status indicators (success/warning/error) visible without color
- Add icons, patterns, or text labels to color-coded elements
Phase 3: Design System Implementation
Extract Design Tokens
- List all unique font sizes → create typography scale
- List all unique spacing values → create spacing scale
- List all colors → map to semantic variables (primary, secondary, accent, etc.)
Create CSS Variables
- Define tokens in
:root or component scope
- Use semantic names (
--font-body, not --font-14px)
- Reference theme colors (
var(--vscode-foreground), not hardcoded hex)
Apply Design Tokens
- Replace hardcoded values with variables
- Example:
font-size: 14px → font-size: var(--font-md)
- Example:
margin: 16px → margin: var(--spacing-md)
Document Design System
- Create design system reference (README or style guide)
- Include token table with usage guidelines
- Add code examples for common patterns
Accessibility Patterns Library
Focus Indicators
/* VS Code-aware focus styling */
:focus-visible {
outline: 2px solid var(--vscode-focusBorder);
outline-offset: 2px;
border-radius: 4px;
}
/* Remove outline for mouse users */
:focus:not(:focus-visible) {
outline: none;
}
Color-Blind Safe Status Indicators
/* Status dots with icons via ::after */
.status-dot {
width: 12px;
height: 12px;
border-radius: 50%;
position: relative;
}
.status-dot.success {
background: #4caf50; /* Green */
}
.status-dot.success::after {
content: '✓'; /* Checkmark icon */
position: absolute;
color: white;
font-size: 10px;
font-weight: bold;
top: -1px;
left: 1px;
}
.status-dot.warning {
background: #ff9800; /* Orange */
}
.status-dot.warning::after {
content: '⚠'; /* Warning icon */
position: absolute;
color: white;
font-size: 10px;
top: -2px;
left: 0px;
}
.status-dot.error {
background: #f44336; /* Red */
}
.status-dot.error::after {
content: '✗'; /* X icon */
position: absolute;
color: white;
font-size: 10px;
font-weight: bold;
top: -1px;
left: 2px;
}
ARIA Progressbar
<!-- Accessible progress bar -->
<div role="progressbar"
aria-valuenow="65"
aria-valuemin="0"
aria-valuemax="100"
aria-label="Task completion">
<div class="progress-fill" style="width: 65%"></div>
</div>
Accessible Buttons
<!-- Semantic button with ARIA -->
<button type="button"
tabindex="0"
aria-label="Generate architecture diagram"
class="action-button">
Generate Diagram
</button>
<!-- Div styled as button (use sparingly) -->
<div role="button"
tabindex="0"
aria-label="Close panel"
class="close-button"
')handleClick()">
×
</div>
Card Layout with Semantic HTML
<article class="card" role="article">
<header>
<h3>Skill Name</h3>
</header>
<div class="card-body">
<p>Description text...</p>
</div>
<footer>
<button aria-label="Activate skill">Activate</button>
</footer>
</article>
Design System Implementation Workflow
Step 1: Audit Current State
# Extract all font-size declarations
grep -r "font-size:" src/ | grep -oP "\d+px" | sort -u
# Extract all spacing values (margin, padding)
grep -r -E "(margin|padding):" src/ | grep -oP "\d+px" | sort -u
# Count unique colors
grep -r -E "(color|background):" src/ | grep -oP "#[0-9a-fA-F]{3,6}" | sort -u
Step 2: Calculate Base Unit
Spacing values found: 4px, 8px, 12px, 16px, 20px, 24px, 32px
GCD = 4px → Base unit = 4px
Scale: 1×, 2×, 3×, 4×, 5×, 6×, 8× (0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 2rem)
Step 3: Create Token System
// Design tokens as JavaScript object
const tokens = {
typography: {
xs: '11px', // Legal minimum
sm: '12px', // Secondary
md: '14px', // Body
lg: '16px', // Heading
xl: '18px' // Large heading
},
spacing: {
xs: '4px',
sm: '8px',
md: '16px',
lg: '24px',
xl: '32px'
},
colors: {
primary: 'var(--vscode-button-background)',
secondary: 'var(--vscode-button-secondaryBackground)',
text: 'var(--vscode-foreground)',
textMuted: 'var(--vscode-descriptionForeground)',
border: 'var(--vscode-panel-border)',
success: '#4caf50',
warning: '#ff9800',
error: '#f44336'
}
};
Step 4: Generate CSS Variables
:root {
/* Typography */
--font-xs: 11px;
--font-sm: 12px;
--font-md: 14px;
--font-lg: 16px;
--font-xl: 18px;
/* Spacing */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
/* Colors (theme-aware) */
--color-primary: var(--vscode-button-background);
--color-text: var(--vscode-foreground);
--color-border: var(--vscode-panel-border);
--color-success: #4caf50;
--color-warning: #ff9800;
--color-error: #f44336;
}
Step 5: Apply Design Tokens
/* Before: Hardcoded values */
.button {
font-size: 14px;
padding: 8px 16px;
background: #007acc;
color: #ffffff;
}
/* After: Design tokens */
.button {
font-size: var(--font-md);
padding: var(--spacing-sm) var(--spacing-md);
background: var(--color-primary);
color: var(--color-text);
}
Testing & Validation
Manual Testing Checklist
Automated Testing Tools
- axe DevTools: Browser extension for WCAG violations
- Lighthouse: Chrome DevTools → Accessibility score
- WAVE: Web Accessibility Evaluation Tool
- Color Contrast Analyzer: Desktop app for WCAG contrast checking
- Pa11y: Command-line accessibility testing
Validation Scripts
// Check for minimum font sizes
const elements = document.querySelectorAll('*');
elements.forEach(el => {
const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
if (fontSize < 11 && fontSize > 0) {
console.warn('Font too small:', el, fontSize + 'px');
}
});
// Check for touch target sizes
const interactive = document.querySelectorAll('button, a, input, [role="button"]');
interactive.forEach(el => {
const rect = el.getBoundingClientRect();
if (rect.width < 44 || rect.height < 44) {
console.warn('Touch target too small:', el, rect.width + '×' + rect.height + 'px');
}
});
// Check for missing ARIA labels
const buttons = document.querySelectorAll('button, [role="button"]');
buttons.forEach(btn => {
if (!btn.textContent.trim() && !btn.getAttribute('aria-label')) {
console.error('Button missing label:', btn);
}
});
Level 3: Resources & References
WCAG 2.1 Specification
Official Documentation
Key Success Criteria
- 1.4.3 Contrast (Minimum) - Level AA: 4.5:1 normal text, 3:1 large text
- 1.4.6 Contrast (Enhanced) - Level AAA: 7:1 normal text, 4.5:1 large text
- 1.4.10 Reflow - Content reflows at 320px width (400% zoom)
- 1.4.11 Non-text Contrast - 3:1 for UI components and graphical objects
- 1.4.12 Text Spacing - No loss of content with increased spacing
- 2.1.1 Keyboard - All functionality via keyboard
- 2.4.7 Focus Visible - Keyboard focus indicator visible
- 2.5.5 Target Size - Touch targets ≥44×44px (Level AAA)
- 4.1.2 Name, Role, Value - ARIA attributes for custom components
Design Systems Examples
Material Design 3
- Typography: 11 type scales (Display, Headline, Title, Body, Label)
- Spacing: 4px base unit, 8dp grid system
- Color: Dynamic color from seed, contrast-safe palettes
- Components: 40+ accessible components with ARIA
- Link: https://m3.material.io/
Apple Human Interface Guidelines
Microsoft Fluent Design
- Typography: Segoe UI Variable, type ramp
- Spacing: 4px base unit
- Components: React, Web Components, .NET
- Accessibility: Built-in ARIA, keyboard navigation
- Link: https://fluent2.microsoft.design/
VS Code Design Guidelines
Design Tools & Resources
Accessibility Testing
Color-Blindness Simulators
Design Token Tools
- Style Dictionary: Build system for design tokens
- Theo: Salesforce design token tool
- Tokens Studio: Figma plugin for design tokens
- CSS Variables Spec: https://www.w3.org/TR/css-variables/
Screen Readers
Code Examples Repository
Accessible Component Patterns
<!-- Modal Dialog -->
<div role="dialog"
aria-labelledby="dialog-title"
aria-describedby="dialog-desc"
aria-modal="true">
<h2 id="dialog-title">Confirm Action</h2>
<p id="dialog-desc">Are you sure you want to proceed?</p>
<button aria-label="Confirm">OK</button>
<button aria-label="Cancel">Cancel</button>
</div>
<!-- Tab Panel -->
<div role="tablist" aria-label="Settings tabs">
<button role="tab" aria-selected="true" aria-controls="panel-1">General</button>
<button role="tab" aria-selected="false" aria-controls="panel-2">Advanced</button>
</div>
<div id="panel-1" role="tabpanel">General settings...</div>
<div id="panel-2" role="tabpanel" hidden>Advanced settings...</div>
<!-- Combobox (Autocomplete) -->
<label for="search">Search</label>
<input id="search"
role="combobox"
aria-autocomplete="list"
aria-expanded="false"
aria-controls="results">
<ul id="results" role="listbox" hidden>
<li role="option">Result 1</li>
<li role="option">Result 2</li>
</ul>
Related Skills
Direct Dependencies
- graphic-design: Visual identity, logo design, brand consistency
- code-review: Accessibility code quality validation
- testing-strategies: Automated accessibility testing integration
Complementary Skills
- markdown-mermaid: Diagram accessibility (alt text, semantic structure)
- vscode-extension-patterns: Webview UI patterns, theme integration
- localization: Internationalization, RTL support, cultural considerations
Common Pitfalls
Typography Mistakes
- Using font sizes <11px (WCAG violation)
- Inconsistent font weights (mixing 450, 500, 550)
- Line-height too tight (<1.4 for body text)
- Font color insufficient contrast
Spacing Mistakes
- Random spacing values (7px, 13px, 21px) instead of scale
- Inconsistent padding within similar components
- Touch targets too close together (<8px spacing)
Accessibility Mistakes
- Using
<div> instead of <button> for clickable elements
- Missing
aria-label on icon-only buttons
- No visible focus indicator
- Color-only status indicators (no icons/text)
- Touch targets <44×44px
Design Token Mistakes
- Hardcoding theme colors (breaks dark mode)
- Using presentational names (
--blue-500) instead of semantic (--color-primary)
- Not using CSS variables consistently
- Missing fallback values for older browsers
Performance Considerations
CSS Variables Performance
- CSS variables have minimal performance impact
- Prefer
:root scope for global tokens
- Use component scope for component-specific overrides
- Avoid excessive
calc() operations with variables
Accessibility Tree Performance
- Excessive ARIA attributes can slow screen readers
- Use semantic HTML instead of ARIA when possible
- Minimize DOM depth for better screen reader performance
- Cache accessibility tree calculations in JS
Version History
v1.0.0 (2026-02-15)
- Initial skill creation based on Alex v5.8.0 accessibility implementation session
- WCAG 2.1 AA compliance patterns from welcomeView.ts refactoring
- Design system implementation workflow from production experience
- Accessibility audit checklist validated against real-world deployment
1---2name: ui-ux-design-63description: User interface design, user experience optimization, accessibility compliance, design systems4---5
6# UI/UX Design
7
8**Domain**: User interface design, user experience optimization, accessibility compliance, design systems
9**Applicable To**: Web applications, VS Code extensions, mobile apps, desktop software
10**Skill Type**: Systematic design audit, accessibility validation, design system implementation
11
12---
13
14## Level 1: Quick Reference
15
16### Core Design Principles
17
18**Visual Hierarchy**
19- Typography scale: base size ≥11px for WCAG AA compliance
20- Weight progression: 400 (regular) → 500 (medium) → 600 (semibold) → 700 (bold)
21- Size jumps: ~2px increments (11px → 13px → 14px → 16px → 18px → 20px)
22
23**Spacing System**
24- Base unit: 4px or 8px (8px recommended for touch interfaces)
25- Scale: base × 0.5, 1, 2, 3, 4, 6, 8, 12 (e.g., 4px, 8px, 16px, 24px, 32px, 48px, 64px, 96px)
26- Consistency: All margins, padding, gaps use scale values
27
28**Color & Contrast**
29- WCAG AA minimum: 4.5:1 for normal text, 3:1 for large text (≥18px or ≥14px bold)
30- WCAG AAA enhanced: 7:1 for normal text, 4.5:1 for large text
31- Color-blind safety: Never rely on color alone (add icons, patterns, text labels)
32
33**Touch Targets**
34- Minimum size: 44×44px (WCAG 2.1 AA Level 2.5.5)
35- Recommended: 48×48px for primary actions
36- Spacing: Minimum 8px between adjacent targets
37
38### WCAG 2.1 AA Compliance Checklist
39
40**Perceivable**
41- ✓ Text alternatives (alt text, aria-label) for non-text content
42- ✓ Color contrast ratio ≥4.5:1 for normal text, ≥3:1 for large text
43- ✓ Text resizable up to 200% without loss of functionality
44- ✓ No information conveyed by color alone
45
46**Operable**
47- ✓ All functionality available via keyboard (tabindex, focus management)
48- ✓ Focus indicators visible (:focus-visible styles)
49- ✓ Touch targets ≥44×44px
50- ✓ No keyboard traps (can tab away from all interactive elements)
51
52**Understandable**
53- ✓ Semantic HTML (header, nav, main, article, aside, footer)
54- ✓ ARIA roles for custom components (button, dialog, menu, tab, progressbar)
55- ✓ Form labels associated with inputs (for/id or aria-labelledby)
56- ✓ Error messages clear and actionable
57
58**Robust**
59- ✓ Valid HTML (no unclosed tags, proper nesting)
60- ✓ ARIA attributes used correctly (aria-valuenow/min/max for progressbar)
61- ✓ Compatible with assistive technologies (screen readers, keyboard-only)
62
63### Design System Quick Setup
64
65**CSS Variables Pattern**
66```css
67:root {
68 /* Typography Scale */
69 --font-xs: 11px; /* Minimum legal size */
70 --font-sm: 12px; /* Secondary text */
71 --font-md: 14px; /* Body text (VS Code default) */
72 --font-lg: 16px; /* Headings, emphasis */
73 --font-xl: 18px; /* Large headings */
74
75 /* Spacing Scale (8px base) */
76 --spacing-xs: 4px; /* Tight spacing */
77 --spacing-sm: 8px; /* Default gap */
78 --spacing-md: 16px; /* Section padding */
79 --spacing-lg: 24px; /* Card padding */
80 --spacing-xl: 32px; /* Page margins */
81
82 /* Theme-aware Colors */
83 --text-primary: var(--vscode-foreground);
84 --text-secondary: var(--vscode-descriptionForeground);
85 --bg-primary: var(--vscode-editor-background);
86 --bg-secondary: var(--vscode-sideBar-background);
87 --border-color: var(--vscode-panel-border);
88 --accent: var(--vscode-button-background);
89}
90```
91
92---
93
94## Level 2: Detailed Practices
95
96### Systematic UI/UX Audit Process
97
98**Phase 1: Visual Assessment**
991. **Typography Audit**
100 - Measure all font sizes (dev tools inspector)
101 - Flag sizes <11px (WCAG AA violation)
102 - Check line-height: 1.4-1.6 for body text
103 - Verify font-weight consistency (avoid random weights like 450, 550)
104
1052. **Spacing Audit**
106 - Inspect margins/padding across components
107 - Identify spacing values (e.g., 7px, 13px, 21px = inconsistent)
108 - Calculate base unit: find GCD of all spacing values
109 - Normalize to scale (e.g., 13px → 12px or 16px)
110
1113. **Color Audit**
112 - Screenshot all color combinations (text on background)
113 - Use contrast checker (WebAIM, Chrome DevTools)
114 - Document violations with severity:
115 - **P0**: <3:1 ratio (immediate fix)
116 - **P1**: 3:1-4.49:1 ratio (fails AA for normal text)
117 - **P2**: 4.5:1-6.99:1 ratio (passes AA, fails AAA)
118
1194. **Touch Target Audit**
120 - Measure interactive elements (buttons, links, checkboxes)
121 - Flag elements <44px in either dimension
122 - Check spacing between adjacent targets (<8px = risk of mis-taps)
123
124**Phase 2: Accessibility Assessment**
1251. **Keyboard Navigation Test**
126 - Tab through entire interface
127 - Verify focus visible on all interactive elements
128 - Check focus order matches visual order
129 - Ensure no keyboard traps (can tab away from modals, menus)
130
1312. **Screen Reader Test**
132 - Use NVDA (Windows), VoiceOver (Mac), or Narrator
133 - Verify all interactive elements have labels
134 - Check landmark regions announced (navigation, main, complementary)
135 - Confirm form fields have associated labels
136
1373. **Semantic HTML Audit**
138 - Inspect DOM structure
139 - Replace `<div>` buttons with `<button>` or `role="button"`
140 - Use `<nav>`, `<article>`, `<aside>`, `<section>` for structure
141 - Add ARIA roles only when semantic HTML insufficient
142
1434. **Color-Blind Safety Test**
144 - Use color-blindness simulator (Coblis, Chrome DevTools)
145 - Check status indicators (success/warning/error) visible without color
146 - Add icons, patterns, or text labels to color-coded elements
147
148**Phase 3: Design System Implementation**
1491. **Extract Design Tokens**
150 - List all unique font sizes → create typography scale
151 - List all unique spacing values → create spacing scale
152 - List all colors → map to semantic variables (primary, secondary, accent, etc.)
153
1542. **Create CSS Variables**
155 - Define tokens in `:root` or component scope
156 - Use semantic names (`--font-body`, not `--font-14px`)
157 - Reference theme colors (`var(--vscode-foreground)`, not hardcoded hex)
158
1593. **Apply Design Tokens**
160 - Replace hardcoded values with variables
161 - Example: `font-size: 14px` → `font-size: var(--font-md)`
162 - Example: `margin: 16px` → `margin: var(--spacing-md)`
163
1644. **Document Design System**
165 - Create design system reference (README or style guide)
166 - Include token table with usage guidelines
167 - Add code examples for common patterns
168
169### Accessibility Patterns Library
170
171**Focus Indicators**
172```css
173/* VS Code-aware focus styling */
174:focus-visible {
175 outline: 2px solid var(--vscode-focusBorder);
176 outline-offset: 2px;
177 border-radius: 4px;
178}
179
180/* Remove outline for mouse users */
181:focus:not(:focus-visible) {
182 outline: none;
183}
184```
185
186**Color-Blind Safe Status Indicators**
187```css
188/* Status dots with icons via ::after */
189.status-dot {
190 width: 12px;
191 height: 12px;
192 border-radius: 50%;
193 position: relative;
194}
195
196.status-dot.success {
197 background: #4caf50; /* Green */
198}
199.status-dot.success::after {
200 content: '✓'; /* Checkmark icon */
201 position: absolute;
202 color: white;
203 font-size: 10px;
204 font-weight: bold;
205 top: -1px;
206 left: 1px;
207}
208
209.status-dot.warning {
210 background: #ff9800; /* Orange */
211}
212.status-dot.warning::after {
213 content: '⚠'; /* Warning icon */
214 position: absolute;
215 color: white;
216 font-size: 10px;
217 top: -2px;
218 left: 0px;
219}
220
221.status-dot.error {
222 background: #f44336; /* Red */
223}
224.status-dot.error::after {
225 content: '✗'; /* X icon */
226 position: absolute;
227 color: white;
228 font-size: 10px;
229 font-weight: bold;
230 top: -1px;
231 left: 2px;
232}
233```
234
235**ARIA Progressbar**
236```html
237<!-- Accessible progress bar -->
238<div role="progressbar"
239 aria-valuenow="65"
240 aria-valuemin="0"
241 aria-valuemax="100"
242 aria-label="Task completion">
243 <div class="progress-fill" style="width: 65%"></div>
244</div>
245```
246
247**Accessible Buttons**
248```html
249<!-- Semantic button with ARIA -->
250<button type="button"
251 tabindex="0"
252 aria-label="Generate architecture diagram"
253 class="action-button">
254 Generate Diagram
255</button>
256
257<!-- Div styled as button (use sparingly) -->
258<div role="button"
259 tabindex="0"
260 aria-label="Close panel"
261 class="close-button"
262 onclick="handleClick()"
263 onkeypress="if(event.key==='Enter'||event.key===' ')handleClick()">
264 ×
265</div>
266```
267
268**Card Layout with Semantic HTML**
269```html
270<article class="card" role="article">
271 <header>
272 <h3>Skill Name</h3>
273 </header>
274 <div class="card-body">
275 <p>Description text...</p>
276 </div>
277 <footer>
278 <button aria-label="Activate skill">Activate</button>
279 </footer>
280</article>
281```
282
283### Design System Implementation Workflow
284
285**Step 1: Audit Current State**
286```bash
287# Extract all font-size declarations
288grep -r "font-size:" src/ | grep -oP "\d+px" | sort -u
289
290# Extract all spacing values (margin, padding)
291grep -r -E "(margin|padding):" src/ | grep -oP "\d+px" | sort -u
292
293# Count unique colors
294grep -r -E "(color|background):" src/ | grep -oP "#[0-9a-fA-F]{3,6}" | sort -u
295```
296
297**Step 2: Calculate Base Unit**
298```
299Spacing values found: 4px, 8px, 12px, 16px, 20px, 24px, 32px
300GCD = 4px → Base unit = 4px
301Scale: 1×, 2×, 3×, 4×, 5×, 6×, 8× (0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 2rem)
302```
303
304**Step 3: Create Token System**
305```javascript
306// Design tokens as JavaScript object
307const tokens = {
308 typography: {
309 xs: '11px', // Legal minimum
310 sm: '12px', // Secondary
311 md: '14px', // Body
312 lg: '16px', // Heading
313 xl: '18px' // Large heading
314 },
315 spacing: {
316 xs: '4px',
317 sm: '8px',
318 md: '16px',
319 lg: '24px',
320 xl: '32px'
321 },
322 colors: {
323 primary: 'var(--vscode-button-background)',
324 secondary: 'var(--vscode-button-secondaryBackground)',
325 text: 'var(--vscode-foreground)',
326 textMuted: 'var(--vscode-descriptionForeground)',
327 border: 'var(--vscode-panel-border)',
328 success: '#4caf50',
329 warning: '#ff9800',
330 error: '#f44336'
331 }
332};
333```
334
335**Step 4: Generate CSS Variables**
336```css
337:root {
338 /* Typography */
339 --font-xs: 11px;
340 --font-sm: 12px;
341 --font-md: 14px;
342 --font-lg: 16px;
343 --font-xl: 18px;
344
345 /* Spacing */
346 --spacing-xs: 4px;
347 --spacing-sm: 8px;
348 --spacing-md: 16px;
349 --spacing-lg: 24px;
350 --spacing-xl: 32px;
351
352 /* Colors (theme-aware) */
353 --color-primary: var(--vscode-button-background);
354 --color-text: var(--vscode-foreground);
355 --color-border: var(--vscode-panel-border);
356 --color-success: #4caf50;
357 --color-warning: #ff9800;
358 --color-error: #f44336;
359}
360```
361
362**Step 5: Apply Design Tokens**
363```css
364/* Before: Hardcoded values */
365.button {
366 font-size: 14px;
367 padding: 8px 16px;
368 background: #007acc;
369 color: #ffffff;
370}
371
372/* After: Design tokens */
373.button {
374 font-size: var(--font-md);
375 padding: var(--spacing-sm) var(--spacing-md);
376 background: var(--color-primary);
377 color: var(--color-text);
378}
379```
380
381### Testing & Validation
382
383**Manual Testing Checklist**
384- [ ] Tab through all interactive elements (keyboard navigation)
385- [ ] Verify focus visible on all focusable elements
386- [ ] Test with screen reader (NVDA, VoiceOver, Narrator)
387- [ ] Zoom to 200% (Ctrl/Cmd +) - verify no content cut off
388- [ ] Test with Windows High Contrast mode
389- [ ] Simulate color blindness (Deuteranopia, Protanopia, Tritanopia)
390- [ ] Test on mobile device or touch simulator (Chrome DevTools)
391- [ ] Verify minimum touch target size (44×44px)
392
393**Automated Testing Tools**
394- **axe DevTools**: Browser extension for WCAG violations
395- **Lighthouse**: Chrome DevTools → Accessibility score
396- **WAVE**: Web Accessibility Evaluation Tool
397- **Color Contrast Analyzer**: Desktop app for WCAG contrast checking
398- **Pa11y**: Command-line accessibility testing
399
400**Validation Scripts**
401```javascript
402// Check for minimum font sizes
403const elements = document.querySelectorAll('*');
404elements.forEach(el => {
405 const fontSize = parseFloat(window.getComputedStyle(el).fontSize);
406 if (fontSize < 11 && fontSize > 0) {
407 console.warn('Font too small:', el, fontSize + 'px');
408 }
409});
410
411// Check for touch target sizes
412const interactive = document.querySelectorAll('button, a, input, [role="button"]');
413interactive.forEach(el => {
414 const rect = el.getBoundingClientRect();
415 if (rect.width < 44 || rect.height < 44) {
416 console.warn('Touch target too small:', el, rect.width + '×' + rect.height + 'px');
417 }
418});
419
420// Check for missing ARIA labels
421const buttons = document.querySelectorAll('button, [role="button"]');
422buttons.forEach(btn => {
423 if (!btn.textContent.trim() && !btn.getAttribute('aria-label')) {
424 console.error('Button missing label:', btn);
425 }
426});
427```
428
429---
430
431## Level 3: Resources & References
432
433### WCAG 2.1 Specification
434
435**Official Documentation**
436- WCAG 2.1 Guidelines: https://www.w3.org/WAI/WCAG21/quickref/
437- Understanding WCAG 2.1: https://www.w3.org/WAI/WCAG21/Understanding/
438- ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/
439
440**Key Success Criteria**
441- **1.4.3 Contrast (Minimum)** - Level AA: 4.5:1 normal text, 3:1 large text
442- **1.4.6 Contrast (Enhanced)** - Level AAA: 7:1 normal text, 4.5:1 large text
443- **1.4.10 Reflow** - Content reflows at 320px width (400% zoom)
444- **1.4.11 Non-text Contrast** - 3:1 for UI components and graphical objects
445- **1.4.12 Text Spacing** - No loss of content with increased spacing
446- **2.1.1 Keyboard** - All functionality via keyboard
447- **2.4.7 Focus Visible** - Keyboard focus indicator visible
448- **2.5.5 Target Size** - Touch targets ≥44×44px (Level AAA)
449- **4.1.2 Name, Role, Value** - ARIA attributes for custom components
450
451### Design Systems Examples
452
453**Material Design 3**
454- Typography: 11 type scales (Display, Headline, Title, Body, Label)
455- Spacing: 4px base unit, 8dp grid system
456- Color: Dynamic color from seed, contrast-safe palettes
457- Components: 40+ accessible components with ARIA
458- Link: https://m3.material.io/
459
460**Apple Human Interface Guidelines**
461- Typography: SF Pro font family, Dynamic Type support
462- Spacing: 8pt grid, consistent margins
463- Touch Targets: 44pt minimum
464- Accessibility: VoiceOver, Dynamic Type, Reduced Motion
465- Link: https://developer.apple.com/design/human-interface-guidelines/
466
467**Microsoft Fluent Design**
468- Typography: Segoe UI Variable, type ramp
469- Spacing: 4px base unit
470- Components: React, Web Components, .NET
471- Accessibility: Built-in ARIA, keyboard navigation
472- Link: https://fluent2.microsoft.design/
473
474**VS Code Design Guidelines**
475- Colors: Theme-aware CSS variables (`--vscode-*`)
476- Typography: VS Code font stack, 13px default
477- Icons: Codicons icon font
478- Components: Webview UI Toolkit
479- Link: https://code.visualstudio.com/api/references/extension-guidelines
480
481### Design Tools & Resources
482
483**Accessibility Testing**
484- **axe DevTools**: https://www.deque.com/axe/devtools/
485- **WAVE**: https://wave.webaim.org/
486- **Lighthouse**: Built into Chrome DevTools
487- **Color Contrast Analyzer**: https://www.tpgi.com/color-contrast-checker/
488- **WebAIM Contrast Checker**: https://webaim.org/resources/contrastchecker/
489
490**Color-Blindness Simulators**
491- **Coblis**: https://www.color-blindness.com/coblis-color-blindness-simulator/
492- **Chrome DevTools**: DevTools → Rendering → Emulate vision deficiencies
493- **Photoshop/Figma**: Built-in color-blind preview modes
494
495**Design Token Tools**
496- **Style Dictionary**: Build system for design tokens
497- **Theo**: Salesforce design token tool
498- **Tokens Studio**: Figma plugin for design tokens
499- **CSS Variables Spec**: https://www.w3.org/TR/css-variables/
500
501**Screen Readers**
502- **NVDA** (Windows, free): https://www.nvaccess.org/
503- **VoiceOver** (Mac, built-in): Cmd+F5 to enable
504- **Narrator** (Windows, built-in): Win+Ctrl+Enter to enable
505- **JAWS** (Windows, commercial): https://www.freedomscientific.com/products/software/jaws/
506
507### Code Examples Repository
508
509**Accessible Component Patterns**
510```html
511<!-- Modal Dialog -->
512<div role="dialog"
513 aria-labelledby="dialog-title"
514 aria-describedby="dialog-desc"
515 aria-modal="true">
516 <h2 id="dialog-title">Confirm Action</h2>
517 <p id="dialog-desc">Are you sure you want to proceed?</p>
518 <button aria-label="Confirm">OK</button>
519 <button aria-label="Cancel">Cancel</button>
520</div>
521
522<!-- Tab Panel -->
523<div role="tablist" aria-label="Settings tabs">
524 <button role="tab" aria-selected="true" aria-controls="panel-1">General</button>
525 <button role="tab" aria-selected="false" aria-controls="panel-2">Advanced</button>
526</div>
527<div id="panel-1" role="tabpanel">General settings...</div>
528<div id="panel-2" role="tabpanel" hidden>Advanced settings...</div>
529
530<!-- Combobox (Autocomplete) -->
531<label for="search">Search</label>
532<input id="search"
533 role="combobox"
534 aria-autocomplete="list"
535 aria-expanded="false"
536 aria-controls="results">
537<ul id="results" role="listbox" hidden>
538 <li role="option">Result 1</li>
539 <li role="option">Result 2</li>
540</ul>
541```
542
543### Related Skills
544
545**Direct Dependencies**
546- **graphic-design**: Visual identity, logo design, brand consistency
547- **code-review**: Accessibility code quality validation
548- **testing-strategies**: Automated accessibility testing integration
549
550**Complementary Skills**
551- **markdown-mermaid**: Diagram accessibility (alt text, semantic structure)
552- **vscode-extension-patterns**: Webview UI patterns, theme integration
553- **localization**: Internationalization, RTL support, cultural considerations
554
555### Common Pitfalls
556
557**Typography Mistakes**
558- Using font sizes <11px (WCAG violation)
559- Inconsistent font weights (mixing 450, 500, 550)
560- Line-height too tight (<1.4 for body text)
561- Font color insufficient contrast
562
563**Spacing Mistakes**
564- Random spacing values (7px, 13px, 21px) instead of scale
565- Inconsistent padding within similar components
566- Touch targets too close together (<8px spacing)
567
568**Accessibility Mistakes**
569- Using `<div>` instead of `<button>` for clickable elements
570- Missing `aria-label` on icon-only buttons
571- No visible focus indicator
572- Color-only status indicators (no icons/text)
573- Touch targets <44×44px
574
575**Design Token Mistakes**
576- Hardcoding theme colors (breaks dark mode)
577- Using presentational names (`--blue-500`) instead of semantic (`--color-primary`)
578- Not using CSS variables consistently
579- Missing fallback values for older browsers
580
581### Performance Considerations
582
583**CSS Variables Performance**
584- CSS variables have minimal performance impact
585- Prefer `:root` scope for global tokens
586- Use component scope for component-specific overrides
587- Avoid excessive `calc()` operations with variables
588
589**Accessibility Tree Performance**
590- Excessive ARIA attributes can slow screen readers
591- Use semantic HTML instead of ARIA when possible
592- Minimize DOM depth for better screen reader performance
593- Cache accessibility tree calculations in JS
594
595### Version History
596
597**v1.0.0** (2026-02-15)
598- Initial skill creation based on Alex v5.8.0 accessibility implementation session
599- WCAG 2.1 AA compliance patterns from welcomeView.ts refactoring
600- Design system implementation workflow from production experience
601- Accessibility audit checklist validated against real-world deployment