一键导入
a11y
Universal accessibility with WCAG 2.1/2.2 Level AA. Trigger: When implementing UI components, adding interactive elements, or ensuring accessibility.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Universal accessibility with WCAG 2.1/2.2 Level AA. Trigger: When implementing UI components, adding interactive elements, or ensuring accessibility.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Audits AI configuration files (AGENTS.md, copilot-instructions.md, SKILL.md files) for instruction duplication. Load when modifying any AI config file, adding a new skill, or reviewing whether instructions have drifted out of sync.
Code review checklist for the F0 React component library. Use when reviewing PRs, auditing component code quality, or checking compliance with F0 conventions before merging. Covers component structure, TypeScript strictness, testing standards, styling, accessibility, and Storybook requirements.
Use when someone wants to add or change something in F0 (a component, prop, token, icon, or pattern). Covers the filter, the alignment, and the build in experimental/. You (the agent) are the door — you search, filter, and guide. For promotion to stable, use f0-component-promotion.
Detailed reference for F0 React component architecture, context/state, styling, testing, i18n, and animation patterns with code examples. Load when building or modifying components in the F0 design system.
Use when promoting an F0 component from experimental/ to stable (Phases 4–5 of the lifecycle). Owned by Foundations team. For building a new component, use f0-component-contribution.
Guide for migrating components from experimental to stable locations (components/, sds/, ui/). Trigger when the user wants to migrate, promote, or move an experimental component, or asks about deprecating experimental exports.
| name | a11y |
| description | Universal accessibility with WCAG 2.1/2.2 Level AA. Trigger: When implementing UI components, adding interactive elements, or ensuring accessibility. |
| license | Apache 2.0 |
| metadata | {"version":"1.0","type":"domain","allowed-tools":["file-reader"]} |
Ensures WCAG 2.1/2.2 Level AA compliance: semantic structure, ARIA, contrast, keyboard nav.
Don't use for:
<!-- ✅ CORRECT: Semantic elements -->
<nav>
<a href="/home">Home</a>
</nav>
<main>
<article>Content</article>
</main>
<button onClick="{action}">Submit</button>
<!-- ❌ WRONG: Non-semantic divs -->
<div class="nav">
<div onClick="{navigate}">Home</div>
</div>
<div class="main">
<div>Content</div>
</div>
<div onClick="{action}">Submit</div>
// ✅ CORRECT: Keyboard events
<button
onClick={handleClick}
onKeyDown={(e) => e.key === 'Enter' && handleClick()}
>
// ❌ WRONG: Mouse-only events
<div onClick={handleClick}> // Not keyboard accessible
<!-- ✅ CORRECT: Associated label -->
<label htmlFor="email">Email Address</label>
<input id="email" type="email" />
<!-- ❌ WRONG: No label association -->
<div>Email Address</div>
<input type="email" />
<!-- ✅ CORRECT: Descriptive alt for informative images -->
<img src="chart.png" alt="Sales increased 25% in Q4" />
<!-- ✅ CORRECT: Empty alt for decorative images -->
<img src="decorative-border.png" alt="" />
<!-- ❌ WRONG: Missing alt -->
<img src="chart.png" />
<nav>, <main>, <article>, <aside>, <footer>)<button> for actions, <a> for navigationaria-label, aria-labelledby, aria-describedbyaria-live, aria-atomicaria-hidden="true" for decorative elementsaria-live for dynamic changesInteractive element (button, link)?
→ Ensure keyboard accessible (Tab, Enter/Space)
→ Visible focus indicator, proper role and semantic element
Form field?
→ Associate <label> with input (htmlFor/id)
→ Provide error messages with aria-describedby
→ Announce errors with aria-live
Dynamic content change?
→ Non-urgent: aria-live="polite"
→ Critical alerts: aria-live="assertive"
→ Whole region: aria-atomic="true"
Custom widget (dropdown, modal, tabs)?
→ Follow WAI-ARIA Authoring Practices patterns
→ Implement keyboard navigation (Arrow keys, Escape, Enter)
→ Manage focus properly
Image or icon?
→ Decorative: alt="" or aria-hidden="true"
→ Informative: descriptive alt text
→ Icon-only button: aria-label
Color conveys meaning?
→ Add text label, icon, or pattern
→ Verify 4.5:1 contrast for text, 3:1 for UI components
Modal or overlay?
→ Trap focus inside modal, restore focus on close
→ Allow Escape to dismiss
→ Use aria-modal="true" and role="dialog"
Loading or status change?
→ Use aria-busy="true" during loading
→ role="status" for status messages
→ Ensure screen reader announces completion
Accessible modal dialog: focus trap, ARIA labels, and keyboard navigation applied together.
function ConfirmDeleteModal({ isOpen, onClose, onConfirm }: ModalProps) {
const firstFocusRef = useRef<HTMLButtonElement>(null);
// Restore focus to trigger on close; trap focus inside modal
useEffect(() => {
if (isOpen) firstFocusRef.current?.focus();
}, [isOpen]);
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose(); // Escape dismisses modal
};
if (!isOpen) return null;
return (
// role="dialog" + aria-modal + aria-labelledby link heading to dialog
<div role="dialog" aria-modal="true" aria-labelledby="modal-title"
onKeyDown={handleKeyDown}>
<h2 id="modal-title">Delete this item?</h2>
<p id="modal-desc">This action cannot be undone.</p>
{/* aria-describedby connects description to the confirm button */}
<button ref={firstFocusRef} aria-describedby="modal-desc"
onClick={onConfirm}>Confirm Delete</button>
<button onClick={onClose}>Cancel</button>
</div>
);
}
Patterns applied: semantic role="dialog", aria-modal, aria-labelledby, aria-describedby, focus management on open, Escape key to dismiss.
WCAG 2.2 updates:**
** Skip links: Provide "Skip to main content" link as first focusable element for keyboard users to bypass navigation.
Focus trap issues: Libraries like React may interfere with focus management. Test focus trap explicitly in modals.
ARIA live regions throttling: Rapid updates may be throttled by screen readers. Debounce updates or use atomic regions.
Touch target size: Minimum 44x44 pixels for touch targets (WCAG 2.1). Use padding to increase clickable area.
Hidden content: Use aria-hidden="true" for visual-only elements. Use sr-only class for screen-reader-only text.
Custom controls: For complex widgets (datepickers, sliders), follow WAI-ARIA Authoring Practices patterns exactly.