SPB Git

spb/ultra-sharp-agent-skills Public

Ultra-Sharp Agent Skills — a research-first skill-authoring system + 72 production-ready skills for AI agents.

Python 100%
4.0 KB · 62 lines markdown
Rendered Raw Blame History
1---2name: ensuring-accessibility3description: Audits and fixes web UI for WCAG 2.2 AA compliance — keyboard navigation, visible focus, ARIA usage, alt text, form labels, color contrast, target sizes, and reduced motion. Use when the user asks to make a page or component accessible, run an accessibility or a11y audit, fix WCAG violations, add ARIA or alt text, improve keyboard or screen-reader support, or check color contrast. Do not use for general semantic markup structure (structuring-semantic-html) or visual design choices.4---56<!--7Author: Simon-Pierre Boucher8Contact: contact@spboucher.ai9-->1011# Ensuring Accessibility1213## When to use / when NOT to use14- **Use for:** auditing or fixing UI against WCAG 2.2 AA — keyboard access, focus, ARIA, alt text, labels, contrast, target sizes, motion preferences.15- **Do NOT use for:** choosing heading/landmark structure for its own sake (structuring-semantic-html), visual design or theming decisions, or backend logic.1617## Core rules18191. **Semantic HTML first, ARIA last.** ARIA only when no native element can express the role (first rule of ARIA).20   -`<button onclick="…">Save</button>`21   -`<div role="button" tabindex="0" onclick="…">Save</div>`22232. **Everything interactive works by keyboard alone,** in a logical Tab order, no traps, no drag-only interactions (WCAG 2.5.7).24   - ✅ sortable list also offers "Move up/Move down" buttons25   - ❌ reorder only via drag-and-drop26273. **Focus must be visible** with ≥3:1 contrast against adjacent colors; never remove it without a replacement.28   -`:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }`29   -`:focus { outline: none; }`30314. **Contrast minimums:** 4.5:1 for normal text, 3:1 for large text (≥24px or ≥18.7px bold) and for UI components/graphics.32335. **Targets ≥24×24 CSS px** (WCAG 2.2), 44×44px for primary touch targets.34356. **Every image has an `alt`:** descriptive for informative images, `alt=""` for decorative ones — never omit the attribute.36   -`<img src="chart.png" alt="Revenue grew 40% from Q1 to Q4">`37   -`<img src="chart.png" alt="chart">`38397. **Every form control has a programmatically associated label** (`<label for>` or `aria-labelledby`); errors linked via `aria-describedby` + `aria-invalid="true"`.40418. **Honor `prefers-reduced-motion`:** disable non-essential animation, parallax, and autoplay when set.4243## Workflow44451. Inventory interactive elements and images on the page/component in scope.462. Apply rules 1–8, fixing violations directly in the markup/CSS (smallest diff that fixes the violation).473. Run automated checks if available (`npx axe-cli <url>` or Lighthouse accessibility category); fix every reported violation.484. **Keyboard-only walkthrough:** Tab through the whole flow — every control reachable, operable (Enter/Space/arrows), focus always visible, no traps.495. **Screen-reader pass** (VoiceOver: Cmd+F5 on macOS): headings/landmarks announce sensibly, images and controls have accessible names, errors are announced.506. Report remaining issues you cannot fix in code (e.g., brand color fails contrast) with the exact measured ratio and a compliant alternative.5152## Edge cases & failure modes5354- **Brand color fails contrast** → do not silently change the brand; report the ratio (e.g., "3.2:1, needs 4.5:1") and propose the nearest compliant shade.55- **Third-party widget is inaccessible** → wrap with an accessible trigger where possible; otherwise flag it as a blocker, don't fake ARIA on top.56- **Icon-only buttons** → require `aria-label`; a tooltip alone is not an accessible name.57- **Dynamic content updates** (toasts, async results) → announce with `aria-live="polite"` (or `role="alert"` for errors only).58- **axe/Lighthouse unavailable** → say so and rely on the manual walkthroughs; never claim "audit passed" on rules 1–8 alone.5960## References61Copy-paste patterns (skip links, focus styles, live regions, accessible modals, contrast tokens): see [references/patterns.md](references/patterns.md)62