{"id":"accessibility-patterns","name":"accessibility-patterns","summary":"WCAG 2.2 AA準拠、ARIAパターン、キーボードナビゲーション、スクリーンリーダー最適化","body":"# Accessibility Patterns\n\n## WCAG 2.2 AA Requirements\n\n### Perceivable\n\n| Kriter | Kural | Kontrol |\n|--------|-------|---------|\n| 1.1.1 | Non-text content alt text | `<img alt=\"description\">` |\n| 1.3.1 | Semantic HTML | Headings, landmarks, lists |\n| 1.4.3 | Color contrast | 4.5:1 normal text, 3:1 large |\n| 1.4.11 | UI component contrast | 3:1 borders, icons |\n\n### Operable\n\n| Kriter | Kural | Kontrol |\n|--------|-------|---------|\n| 2.1.1 | Keyboard accessible | Tab, Enter, Space, Escape |\n| 2.4.3 | Focus order | Logical tab sequence |\n| 2.4.7 | Focus visible | Visible focus indicator |\n| 2.5.8 | Target size | Min 24x24px (44x44px önerilir) |\n\n### Understandable\n\n| Kriter | Kural | Kontrol |\n|--------|-------|---------|\n| 3.1.1 | Language of page | `<html lang=\"tr\">` |\n| 3.2.1 | On focus | No unexpected context change |\n| 3.3.1 | Error identification | Clear error messages |\n| 3.3.2 | Labels or instructions | Form labels visible |\n\n## ARIA Patterns\n\n```html\n<!-- Dialog -->\n<div role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"title\">\n  <h2 id=\"title\">Confirm</h2>\n  <button aria-label=\"Close dialog\">×</button>\n</div>\n\n<!-- Tabs -->\n<div role=\"tablist\">\n  <button role=\"tab\" aria-selected=\"true\" aria-controls=\"panel1\">Tab 1</button>\n  <button role=\"tab\" aria-selected=\"false\" aria-controls=\"panel2\">Tab 2</button>\n</div>\n<div role=\"tabpanel\" id=\"panel1\">Content 1</div>\n\n<!-- Live region (dynamic updates) -->\n<div aria-live=\"polite\" aria-atomic=\"true\">\n  3 new messages\n</div>\n```\n\n## Keyboard Navigation\n\n```typescript\n// Focus trap (modal/dialog)\nfunction useFocusTrap(ref: RefObject<HTMLElement>) {\n  useEffect(() => {\n    const focusable = ref.current?.querySelectorAll(\n      'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n    )\n    const first = focusable?.[0] as HTMLElement\n    const last = focusable?.[focusable.length - 1] as HTMLElement\n\n    function handleKeyDown(e: KeyboardEvent) {\n      if (e.key !== 'Tab') return\n      if (e.shiftKey && document.activeElement === first) {\n        e.preventDefault(); last.focus()\n      } else if (!e.shiftKey && document.activeElement === last) {\n        e.preventDefault(); first.focus()\n      }\n    }\n    ref.current?.addEventListener('keydown', handleKeyDown)\n    first?.focus()\n    return () => ref.current?.removeEventListener('keydown', handleKeyDown)\n  }, [ref])\n}\n```\n\n## Skip Links\n\n```html\n<a href=\"#main-content\" class=\"skip-link\">Skip to main content</a>\n<!-- ... navigation ... -->\n<main id=\"main-content\">...</main>\n\n<style>\n.skip-link {\n  position: absolute;\n  top: -40px;\n  left: 0;\n  z-index: 100;\n}\n.skip-link:focus { top: 0; }\n</style>\n```\n\n## Motion Preferences\n\n```css\n@media (prefers-reduced-motion: reduce) {\n  *, *::before, *::after {\n    animation-duration: 0.01ms !important;\n    transition-duration: 0.01ms !important;\n  }\n}\n```\n\n## Testing\n\n```bash\n# axe-core (automated)\nnpx @axe-core/cli https://localhost:3000\n\n# Lighthouse accessibility audit\nlighthouse --only-categories=accessibility https://localhost:3000\n```\n\n## Checklist\n\n- [ ] Semantic HTML (headings, landmarks, lists)\n- [ ] Alt text on all images\n- [ ] Color contrast 4.5:1 (text), 3:1 (UI)\n- [ ] Keyboard navigable (tab order logical)\n- [ ] Focus visible indicator\n- [ ] Skip link to main content\n- [ ] Form labels and error messages\n- [ ] ARIA roles where needed\n- [ ] prefers-reduced-motion respected\n- [ ] axe-core test pass\n\n## Anti-Patterns\n\n- `<div onclick>` instead of `<button>`\n- Color-only information (add icon/text)\n- Auto-playing video/audio\n- Removing focus outline without replacement\n- Using ARIA when native HTML suffices","author":"@vibeeval","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/vibeeval/vibecosystem/tree/main/skills/accessibility-patterns","license":"MIT","category":"design","lang":"en","tokens":1036,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}