用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Dev-Toolbelt/dev-team-agents --skill accessibility-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | accessibility-patterns |
| description | WCAG accessibility — load only when explicitly required. |
When to load this skill: only when the project requires WCAG compliance (documented in project context), the user explicitly requests accessibility work, or an audit tool (axe, Lighthouse) flags specific violations. Do not apply these patterns as default constraints on every task.
Focus must be explicitly managed whenever the UI changes in ways the browser cannot handle automatically.
| Scenario | Required action |
|---|---|
| Modal / dialog opens | Move focus to the first interactive element inside, or the dialog container |
| Modal / dialog closes | Return focus to the trigger element that opened it |
| SPA route navigation | Move focus to the main heading or the <main> landmark of the new page |
| Inline error appears | Move focus to the error summary or the first invalid field |
| Dynamic content inserted (toast, alert) | Announce via a live region — do not move focus |
<button> beats <div role="button">. ARIA fills gaps that semantic HTML cannot.<button aria-role="button"> is redundant noise.role — what it is (combobox, tab, tree)aria-label, aria-labelledby, or visible textaria-expanded, aria-selected, aria-checked as appropriate| Component | Role | Required states |
|---|---|---|
| Tabs | tablist / tab / tabpanel | aria-selected, aria-controls |
| Accordion | button + region | aria-expanded, aria-controls |
| Combobox / autocomplete | combobox + listbox | aria-expanded, aria-activedescendant |
| Modal | dialog | aria-modal="true", aria-labelledby |
| Alert / toast | alert or status | live region (aria-live="polite" or "assertive") |
| Progress bar | progressbar | aria-valuenow, aria-valuemin, aria-valuemax |
Use live regions for content that changes without a focus move (notifications, status updates, async results).
<!-- polite: announced after the user finishes their current action -->
<div aria-live="polite" aria-atomic="true">3 results found</div>
<!-- assertive: interrupts immediately — use only for errors or critical alerts -->
<div role="alert">Your session has expired.</div>
Rules:
aria-atomic="true" announces the full region on each update; omit it when only the new portion should be readEvery interactive element must be reachable and operable by keyboard alone.
| Key | Expected behavior |
|---|---|
Tab / Shift+Tab | Moves focus forward / backward through focusable elements |
Enter / Space | Activates buttons, links, checkboxes |
Escape | Closes modals, dropdowns, popovers |
| Arrow keys | Navigates within composite widgets (menus, tabs, radio groups, grids) |
Focus trap: when a modal is open, Tab must cycle within it — focus must not escape to the background. Use a focus trap utility rather than implementing it manually.
<a href="#main-content">Skip to main content</a><main>, one <header>, one <nav> (if navigation is present)<nav> elements must be distinguished with aria-label: aria-label="Primary", aria-label="Breadcrumb"axe-core (via jest-axe, @axe-core/playwright, or Storybook a11y addon) — catches ~30–40% of issues automatically