Skip to main content

setup-accessibility

Enforce ARIA accessibility via PostToolUse hooks -- labels, keyboard handlers, widget attributes, Playwright AXE setup. Use when setting up a11y enforcement, WCAG 2.1 AA compliance, or accessibility testing.

来源信息

仓库
redpanda-data/ui-harness
最近来源活动
2026年5月8日 11:21
检测到的 SKILL.md 语言
英语
星标
34
分支
4

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
setup-accessibility
description
Enforce ARIA accessibility via PostToolUse hooks -- labels, keyboard handlers, widget attributes, Playwright AXE setup. Use when setting up a11y enforcement, WCAG 2.1 AA compliance, or accessibility testing.
paths
["src/components/**/*.tsx"]
# Accessibility Enforcement ## What This Catches - **`<img>` without `alt`** -- use `alt=""` for decorative img - **Mouse-only `onClick` on `<div>`/`<span>`** -- needs `role` + `tabIndex` + `onKeyDown`/`onKeyUp` - **Missing ARIA on widget roles** -- `role="combobox"` needs `aria-expanded` + `aria-controls`, `role="dialog"` needs `aria-label`/`aria-labelledby`, `role="tablist"` needs child `role="tab"` Escape hatch: `// allow: a11y-skip [reason]` ## No Nested Pressables Interactive components ONE pattern -- never both: **Pattern A: Container clickable** -- no interactive children. ```tsx <ListCard onClick={handleSelect}> <Avatar src={user.avatar} /> <Text>{user.name}</Text> <ChevronRightIcon /> {/* visual indicator only, not a button */} </ListCard> ``` **Pattern B: Children interactive** -- container not clickable. ```tsx <ListCard> <Avatar src={user.avatar} /> <Text>{user.name}</Text> <DropdownMenu> <DropdownMenuTrigger asChild> <Button variant="ghost" size="icon"><MoreVerticalIcon /></Button> </DropdownMenuTrigger> </DropdownMenu> </ListCard> ``` Why: ambiguous click targets, event bubbling bugs, screen readers can't convey interaction model, touch targets overlap on mobile. ## Visual Checklist - [ ] Focus rings visible on all interactive elements (min 2px, contrasting color) - [ ] Hover and focus styles match (no mouse-only affordances) - [ ] Color not sole means of conveying info - [ ] Touch targets min 44x44 CSS pixels - [ ] `prefers-reduced-motion` respected for animations - [ ] `forced-colors` / high-contrast mode: use `currentcolor` for SVG fills - [ ] Text resizable to 200% without content loss Initial setup (install, AXE fixture, hook config): see [SETUP.md](SETUP.md).
在 GitHub 查看