[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70FYTSVY5FYWKFA5DFVW1P9":3,"skill-same:01M70FYTSVY5FYWKFA5DFVW1P9":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":6,"ownerHtmlUrl":60,"ownerBlogUrl":6,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M70FYTSVY5FYWKFA5DFVW1P9","frontend-a11y",null,"Accessibility patterns for React and Next.js — semantic HTML, ARIA attributes, form labeling, keyboard navigation, focus management, and screen reader support. Use when building or reviewing forms, modals, dropdowns, tooltips, or tabs, fixing a11y lint or code-review findings, or wiring up keyboard navigation and focus management.","mdnaimul22\u002Fhuman-skills","mdnaimul22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F64520358?v=4","01M70FH95MH2H796Q01TYSFZ03","Naimul","01M70FH96798CQR4YHA13F17GA",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ffrontend-a11y\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"frontend a11y","a11y","frontend","forms","aria","screen","support","next","focus","keyboard","review","react","wiring","code-review","code","when","up","review findings","attributes","community","2026-11-10 10:12:30",false,"---\nname: frontend-a11y\ndescription: Accessibility patterns for React and Next.js — semantic HTML, ARIA attributes, form labeling, keyboard navigation, focus management, and screen reader support. Use when building or reviewing forms, modals, dropdowns, tooltips, or tabs, fixing a11y lint or code-review findings, or wiring up keyboard navigation and focus management.\nmetadata:\n  origin: community\n---\n\n# Frontend Accessibility Patterns\n\nPractical accessibility patterns for React and Next.js. Covers the issues most commonly flagged in code review: missing form labels, incorrect ARIA usage, non-semantic interactive elements, and broken keyboard navigation.\n\n## When to Activate\n\n- Building or reviewing form components (`\u003Cinput>`, `\u003Cselect>`, `\u003Ctextarea>`)\n- Creating interactive elements (modals, dropdowns, tooltips, tabs)\n- Using `\u003Cdiv>` or `\u003Cspan>` with `onClick`\n- Adding `aria-*` attributes to any element\n- Implementing keyboard navigation or focus management\n- Receiving accessibility feedback from code review tools (CodeRabbit, ESLint a11y)\n- Building components that must support screen readers\n\n## Form Accessibility\n\nMissing `htmlFor` \u002F `id` pairing and disconnected error messages are the most common issues flagged in code review.\n\n### Label Connection\n\n```tsx\n\u002F\u002F BAD: label has no connection to input — screen readers cannot associate them\n\u003Clabel>Email\u003C\u002Flabel>\n\u003Cinput type=\"email\" \u002F>\n\n\u002F\u002F GOOD: htmlFor matches input id\n\u003Clabel htmlFor=\"email\">Email\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n```\n\n### Required Fields\n\n```tsx\n\u002F\u002F BAD: visual-only asterisk conveys nothing to screen readers\n\u003Clabel htmlFor=\"email\">Email *\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n\n\u002F\u002F GOOD: required enables native browser validation; aria-required signals it to screen readers\n\u003Clabel htmlFor=\"email\">\n  Email \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" required aria-required=\"true\" \u002F>\n```\n\n### Error Messages\n\n```tsx\n\u002F\u002F BAD: error text exists visually but is not linked to the input\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n\u003Cspan className=\"error\">Invalid email address\u003C\u002Fspan>\n\n\u002F\u002F GOOD: aria-describedby connects input to its error message\n\u002F\u002F aria-invalid signals the invalid state to screen readers\n\u003Cinput\n  id=\"email\"\n  type=\"email\"\n  aria-describedby=\"email-error\"\n  aria-invalid={!!error}\n\u002F>\n{error && (\n  \u003Cspan id=\"email-error\" role=\"alert\">\n    {error}\n  \u003C\u002Fspan>\n)}\n```\n\n### Complete Accessible Form\n\n```tsx\ninterface LoginFormProps {\n  onSubmit: (email: string, password: string) => void;\n}\n\nexport function LoginForm({ onSubmit }: LoginFormProps) {\n  const [email, setEmail] = useState('');\n  const [password, setPassword] = useState('');\n  const [errors, setErrors] = useState\u003C{ email?: string; password?: string }>({});\n\n  const handleSubmit = (e: React.FormEvent) => {\n    e.preventDefault();\n    const newErrors: typeof errors = {};\n    if (!email) newErrors.email = 'Email is required';\n    if (!password) newErrors.password = 'Password is required';\n    if (Object.keys(newErrors).length) {\n      setErrors(newErrors);\n      return;\n    }\n    onSubmit(email, password);\n  };\n\n  return (\n    \u003Cform onSubmit={handleSubmit} noValidate>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"email\">\n          Email \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n        \u003C\u002Flabel>\n        \u003Cinput\n          id=\"email\"\n          type=\"email\"\n          value={email}\n          onChange={e => setEmail(e.target.value)}\n          aria-required=\"true\"\n          aria-describedby={errors.email ? 'email-error' : undefined}\n          aria-invalid={!!errors.email}\n          autoComplete=\"email\"\n        \u002F>\n        {errors.email && (\n          \u003Cspan id=\"email-error\" role=\"alert\">\n            {errors.email}\n          \u003C\u002Fspan>\n        )}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"password\">\n          Password \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n        \u003C\u002Flabel>\n        \u003Cinput\n          id=\"password\"\n          type=\"password\"\n          value={password}\n          onChange={e => setPassword(e.target.value)}\n          aria-required=\"true\"\n          aria-describedby={errors.password ? 'password-error' : undefined}\n          aria-invalid={!!errors.password}\n          autoComplete=\"current-password\"\n        \u002F>\n        {errors.password && (\n          \u003Cspan id=\"password-error\" role=\"alert\">\n            {errors.password}\n          \u003C\u002Fspan>\n        )}\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\">Log in\u003C\u002Fbutton>\n    \u003C\u002Fform>\n  );\n}\n```\n\n## Semantic HTML\n\nUse the element that matches the intent. Screen readers and keyboard users depend on native semantics.\n\n```tsx\n\u002F\u002F BAD: div has no role, no keyboard support, no accessible name\n\u003Cdiv onClick={handleClick}>Submit\u003C\u002Fdiv>\n\n\u002F\u002F GOOD: button is focusable, activates on Enter\u002FSpace, announces as \"button\"\n\u003Cbutton type=\"button\" onClick={handleClick}>Submit\u003C\u002Fbutton>\n```\n\n```tsx\n\u002F\u002F BAD: non-semantic navigation\n\u003Cdiv onClick={() => navigate('\u002Fhome')}>Home\u003C\u002Fdiv>\n\n\u002F\u002F GOOD: anchor supports right-click, middle-click, and keyboard navigation\n\u003Ca href=\"\u002Fhome\">Home\u003C\u002Fa>\n```\n\n```tsx\n\u002F\u002F BAD: heading hierarchy skipped (h1 to h4)\n\u003Ch1>Dashboard\u003C\u002Fh1>\n\u003Ch4>Recent Activity\u003C\u002Fh4>\n\n\u002F\u002F GOOD: sequential heading levels\n\u003Ch1>Dashboard\u003C\u002Fh1>\n\u003Ch2>Recent Activity\u003C\u002Fh2>\n```\n\n## ARIA Attributes\n\nUse ARIA only when native HTML semantics are insufficient. Wrong ARIA is worse than no ARIA.\n\n### aria-label vs aria-labelledby\n\n```tsx\n\u002F\u002F aria-label: inline string label — use when no visible label text exists\n\u003Cbutton aria-label=\"Close modal\">\n  \u003CXIcon \u002F>\n\u003C\u002Fbutton>\n\n\u002F\u002F aria-labelledby: references another element's text — use when a visible label exists\n\u003Csection aria-labelledby=\"section-title\">\n  \u003Ch2 id=\"section-title\">Recent Orders\u003C\u002Fh2>\n  {\u002F* content *\u002F}\n\u003C\u002Fsection>\n```\n\n### aria-describedby\n\n```tsx\n\u002F\u002F Provides supplementary description beyond the label\n\u003Cbutton\n  aria-describedby=\"delete-warning\"\n  onClick={handleDelete}\n> Delete account\n\u003C\u002Fbutton>\n\u003Cp id=\"delete-warning\">This action cannot be undone.\u003C\u002Fp>\n```\n\n### aria-live for Dynamic Content\n\n```tsx\n\u002F\u002F Use aria-live to announce content that updates without a page reload\n\u002F\u002F polite: waits for user to finish current action before announcing\n\u002F\u002F assertive: interrupts immediately — use only for urgent errors\n\nexport function StatusMessage({ message, isError }: { message: string; isError?: boolean }) {\n  return (\n    \u003Cdiv role=\"status\" aria-live={isError ? 'assertive' : 'polite'} aria-atomic=\"true\">\n      {message}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n### aria-expanded and aria-controls\n\n```tsx\nexport function Accordion({ title, children }: { title: string; children: React.ReactNode }) {\n  const [isOpen, setIsOpen] = useState(false);\n  const contentId = useId();\n\n  return (\n    \u003Cdiv>\n      \u003Cbutton aria-expanded={isOpen} aria-controls={contentId} onClick={() => setIsOpen(prev => !prev)}>\n        {title}\n      \u003C\u002Fbutton>\n      \u003Cdiv id={contentId} hidden={!isOpen}>\n        {children}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Keyboard Navigation\n\nEvery interactive element must be reachable and operable by keyboard alone.\n\n### Custom Dropdown\n\n```tsx\nexport function Dropdown({ options, onSelect }: { options: string[]; onSelect: (value: string) => void }) {\n  const [isOpen, setIsOpen] = useState(false);\n  const [activeIndex, setActiveIndex] = useState(0);\n  const listId = useId();\n\n  if (!options.length) return null;\n\n  const handleKeyDown = (e: React.KeyboardEvent) => {\n    switch (e.key) {\n      case 'ArrowDown':\n        e.preventDefault();\n        setActiveIndex(i => Math.min(i + 1, options.length - 1));\n        break;\n      case 'ArrowUp':\n        e.preventDefault();\n        setActiveIndex(i => Math.max(i - 1, 0));\n        break;\n      case 'Enter':\n      case ' ':\n        e.preventDefault();\n        if (isOpen) onSelect(options[activeIndex]);\n        setIsOpen(prev => !prev);\n        break;\n      case 'Escape':\n        setIsOpen(false);\n        break;\n    }\n  };\n\n  return (\n    \u003Cdiv\n      role=\"combobox\"\n      aria-expanded={isOpen}\n      aria-haspopup=\"listbox\"\n      aria-controls={listId}\n      tabIndex={0}\n      onKeyDown={handleKeyDown}\n      onClick={() => setIsOpen(prev => !prev)}\n    >\n      \u003Cspan>{options[activeIndex]}\u003C\u002Fspan>\n      {isOpen && (\n        \u003Cul id={listId} role=\"listbox\">\n          {options.map((option, index) => (\n            \u003Cli\n              key={option}\n              role=\"option\"\n              aria-selected={index === activeIndex}\n              onClick={() => {\n                onSelect(option);\n                setIsOpen(false);\n              }}\n            >\n              {option}\n            \u003C\u002Fli>\n          ))}\n        \u003C\u002Ful>\n      )}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Focus Management\n\nFocus must move logically when UI state changes — especially for modals and route transitions.\n\n### Modal Focus Restoration\n\n> This example covers initial focus and restoration. For a full focus trap (Tab\u002FShift+Tab cycling within the modal), use a library like [`focus-trap-react`](https:\u002F\u002Fgithub.com\u002Ffocus-trap\u002Ffocus-trap-react) which handles edge cases like dynamic content and nested portals.\n\n```tsx\nexport function Modal({ isOpen, onClose, title, children }: { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode }) {\n  const modalRef = useRef\u003CHTMLDivElement>(null);\n  const previousFocusRef = useRef\u003CHTMLElement | null>(null);\n\n  useEffect(() => {\n    if (isOpen) {\n      \u002F\u002F Save currently focused element and move focus into modal\n      previousFocusRef.current = document.activeElement as HTMLElement;\n      modalRef.current?.focus();\n    } else {\n      \u002F\u002F Restore focus to the element that opened the modal\n      previousFocusRef.current?.focus();\n    }\n  }, [isOpen]);\n\n  if (!isOpen) return null;\n\n  return (\n    \u003Cdiv ref={modalRef} role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"modal-title\" tabIndex={-1} onKeyDown={e => e.key === 'Escape' && onClose()}>\n      \u003Ch2 id=\"modal-title\">{title}\u003C\u002Fh2>\n      {children}\n      \u003Cbutton onClick={onClose}>Close\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Images and Icons\n\n```tsx\n\u002F\u002F BAD: decorative icon announced as unlabeled image\n\u003Cimg src=\"\u002Ficon.svg\" \u002F>\n\n\u002F\u002F GOOD: decorative image hidden from screen readers\n\u003Cimg src=\"\u002Fdecoration.png\" alt=\"\" aria-hidden=\"true\" \u002F>\n\n\u002F\u002F GOOD: meaningful image with descriptive alt text\n\u003Cimg src=\"\u002Fchart.png\" alt=\"Monthly revenue increased 23% from January to March\" \u002F>\n\n\u002F\u002F GOOD: icon button with accessible label\n\u003Cbutton aria-label=\"Delete item\">\n  \u003CTrashIcon aria-hidden=\"true\" \u002F>\n\u003C\u002Fbutton>\n```\n\n## Reduced Motion\n\nRespect users who have requested reduced motion in their OS settings.\n\n```tsx\nexport function useReducedMotion(): boolean {\n  const [prefersReduced, setPrefersReduced] = useState(false);\n\n  useEffect(() => {\n    const mq = window.matchMedia('(prefers-reduced-motion: reduce)');\n    setPrefersReduced(mq.matches);\n    const handler = (e: MediaQueryListEvent) => setPrefersReduced(e.matches);\n    mq.addEventListener('change', handler);\n    return () => mq.removeEventListener('change', handler);\n  }, []);\n\n  return prefersReduced;\n}\n\n\u002F\u002F Usage\nexport function AnimatedCard({ children }: { children: React.ReactNode }) {\n  const reduceMotion = useReducedMotion();\n\n  return (\n    \u003Cdiv\n      style={{\n        transition: reduceMotion ? 'none' : 'transform 300ms ease'\n      }}\n    >\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Anti-Patterns\n\n```tsx\n\u002F\u002F BAD: onClick on non-interactive element with no keyboard support\n\u003Cdiv onClick={handleClick}>Click me\u003C\u002Fdiv>\n\n\u002F\u002F BAD: aria-label on a div that has no role\n\u003Cdiv aria-label=\"Navigation\">...\u003C\u002Fdiv>\n\n\u002F\u002F BAD: placeholder used as a substitute for label\n\u003Cinput placeholder=\"Enter your email\" \u002F>\n\n\u002F\u002F BAD: positive tabIndex creates unpredictable tab order\n\u003Cbutton tabIndex={3}>Submit\u003C\u002Fbutton>\n\n\u002F\u002F BAD: aria-hidden on a focusable element — keyboard users get trapped\n\u003Cbutton aria-hidden=\"true\">Open\u003C\u002Fbutton>\n\n\u002F\u002F BAD: role=\"button\" on div without keyboard handler\n\u003Cdiv role=\"button\" onClick={handleClick}>Submit\u003C\u002Fdiv>\n\u002F\u002F Missing: tabIndex={0}, onKeyDown for Enter\u002FSpace\n```\n\n## Checklist\n\nBefore submitting any interactive component for review:\n\n- [ ] Every `\u003Cinput>`, `\u003Cselect>`, and `\u003Ctextarea>` has a connected `\u003Clabel>` via `htmlFor`\u002F`id`\n- [ ] Error messages are linked with `aria-describedby` and marked `role=\"alert\"`\n- [ ] No `onClick` on `\u003Cdiv>` or `\u003Cspan>` without `role`, `tabIndex`, and `onKeyDown`\n- [ ] Icon-only buttons have `aria-label`\n- [ ] Decorative images use `alt=\"\"` and `aria-hidden=\"true\"`\n- [ ] Modals restore focus on close (for full focus trapping with Tab\u002FShift+Tab cycling, use a library like `focus-trap-react`)\n- [ ] Dynamic content updates use `aria-live`\n- [ ] `prefers-reduced-motion` is respected for animations\n\n## Related Skills\n\n- `frontend-patterns` — general React component and state patterns\n- `design-system` — design token and component consistency\n- `motion-foundations` and `motion-patterns`: animation patterns with accessibility considerations\n","# Frontend Accessibility Patterns\n\nPractical accessibility patterns for React and Next.js. Covers the issues most commonly flagged in code review: missing form labels, incorrect ARIA usage, non-semantic interactive elements, and broken keyboard navigation.\n\n## When to Activate\n\n- Building or reviewing form components (`\u003Cinput>`, `\u003Cselect>`, `\u003Ctextarea>`)\n- Creating interactive elements (modals, dropdowns, tooltips, tabs)\n- Using `\u003Cdiv>` or `\u003Cspan>` with `onClick`\n- Adding `aria-*` attributes to any element\n- Implementing keyboard navigation or focus management\n- Receiving accessibility feedback from code review tools (CodeRabbit, ESLint a11y)\n- Building components that must support screen readers\n\n## Form Accessibility\n\nMissing `htmlFor` \u002F `id` pairing and disconnected error messages are the most common issues flagged in code review.\n\n### Label Connection\n\n```tsx\n\u002F\u002F BAD: label has no connection to input — screen readers cannot associate them\n\u003Clabel>Email\u003C\u002Flabel>\n\u003Cinput type=\"email\" \u002F>\n\n\u002F\u002F GOOD: htmlFor matches input id\n\u003Clabel htmlFor=\"email\">Email\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n```\n\n### Required Fields\n\n```tsx\n\u002F\u002F BAD: visual-only asterisk conveys nothing to screen readers\n\u003Clabel htmlFor=\"email\">Email *\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n\n\u002F\u002F GOOD: required enables native browser validation; aria-required signals it to screen readers\n\u003Clabel htmlFor=\"email\">\n  Email \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n\u003C\u002Flabel>\n\u003Cinput id=\"email\" type=\"email\" required aria-required=\"true\" \u002F>\n```\n\n### Error Messages\n\n```tsx\n\u002F\u002F BAD: error text exists visually but is not linked to the input\n\u003Cinput id=\"email\" type=\"email\" \u002F>\n\u003Cspan className=\"error\">Invalid email address\u003C\u002Fspan>\n\n\u002F\u002F GOOD: aria-describedby connects input to its error message\n\u002F\u002F aria-invalid signals the invalid state to screen readers\n\u003Cinput\n  id=\"email\"\n  type=\"email\"\n  aria-describedby=\"email-error\"\n  aria-invalid={!!error}\n\u002F>\n{error && (\n  \u003Cspan id=\"email-error\" role=\"alert\">\n    {error}\n  \u003C\u002Fspan>\n)}\n```\n\n### Complete Accessible Form\n\n```tsx\ninterface LoginFormProps {\n  onSubmit: (email: string, password: string) => void;\n}\n\nexport function LoginForm({ onSubmit }: LoginFormProps) {\n  const [email, setEmail] = useState('');\n  const [password, setPassword] = useState('');\n  const [errors, setErrors] = useState\u003C{ email?: string; password?: string }>({});\n\n  const handleSubmit = (e: React.FormEvent) => {\n    e.preventDefault();\n    const newErrors: typeof errors = {};\n    if (!email) newErrors.email = 'Email is required';\n    if (!password) newErrors.password = 'Password is required';\n    if (Object.keys(newErrors).length) {\n      setErrors(newErrors);\n      return;\n    }\n    onSubmit(email, password);\n  };\n\n  return (\n    \u003Cform onSubmit={handleSubmit} noValidate>\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"email\">\n          Email \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n        \u003C\u002Flabel>\n        \u003Cinput\n          id=\"email\"\n          type=\"email\"\n          value={email}\n          onChange={e => setEmail(e.target.value)}\n          aria-required=\"true\"\n          aria-describedby={errors.email ? 'email-error' : undefined}\n          aria-invalid={!!errors.email}\n          autoComplete=\"email\"\n        \u002F>\n        {errors.email && (\n          \u003Cspan id=\"email-error\" role=\"alert\">\n            {errors.email}\n          \u003C\u002Fspan>\n        )}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv>\n        \u003Clabel htmlFor=\"password\">\n          Password \u003Cspan aria-hidden=\"true\">*\u003C\u002Fspan>\n        \u003C\u002Flabel>\n        \u003Cinput\n          id=\"password\"\n          type=\"password\"\n          value={password}\n          onChange={e => setPassword(e.target.value)}\n          aria-required=\"true\"\n          aria-describedby={errors.password ? 'password-error' : undefined}\n          aria-invalid={!!errors.password}\n          autoComplete=\"current-password\"\n        \u002F>\n        {errors.password && (\n          \u003Cspan id=\"password-error\" role=\"alert\">\n            {errors.password}\n          \u003C\u002Fspan>\n        )}\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\">Log in\u003C\u002Fbutton>\n    \u003C\u002Fform>\n  );\n}\n```\n\n## Semantic HTML\n\nUse the element that matches the intent. Screen readers and keyboard users depend on native semantics.\n\n```tsx\n\u002F\u002F BAD: div has no role, no keyboard support, no accessible name\n\u003Cdiv onClick={handleClick}>Submit\u003C\u002Fdiv>\n\n\u002F\u002F GOOD: button is focusable, activates on Enter\u002FSpace, announces as \"button\"\n\u003Cbutton type=\"button\" onClick={handleClick}>Submit\u003C\u002Fbutton>\n```\n\n```tsx\n\u002F\u002F BAD: non-semantic navigation\n\u003Cdiv onClick={() => navigate('\u002Fhome')}>Home\u003C\u002Fdiv>\n\n\u002F\u002F GOOD: anchor supports right-click, middle-click, and keyboard navigation\n\u003Ca href=\"\u002Fhome\">Home\u003C\u002Fa>\n```\n\n```tsx\n\u002F\u002F BAD: heading hierarchy skipped (h1 to h4)\n\u003Ch1>Dashboard\u003C\u002Fh1>\n\u003Ch4>Recent Activity\u003C\u002Fh4>\n\n\u002F\u002F GOOD: sequential heading levels\n\u003Ch1>Dashboard\u003C\u002Fh1>\n\u003Ch2>Recent Activity\u003C\u002Fh2>\n```\n\n## ARIA Attributes\n\nUse ARIA only when native HTML semantics are insufficient. Wrong ARIA is worse than no ARIA.\n\n### aria-label vs aria-labelledby\n\n```tsx\n\u002F\u002F aria-label: inline string label — use when no visible label text exists\n\u003Cbutton aria-label=\"Close modal\">\n  \u003CXIcon \u002F>\n\u003C\u002Fbutton>\n\n\u002F\u002F aria-labelledby: references another element's text — use when a visible label exists\n\u003Csection aria-labelledby=\"section-title\">\n  \u003Ch2 id=\"section-title\">Recent Orders\u003C\u002Fh2>\n  {\u002F* content *\u002F}\n\u003C\u002Fsection>\n```\n\n### aria-describedby\n\n```tsx\n\u002F\u002F Provides supplementary description beyond the label\n\u003Cbutton\n  aria-describedby=\"delete-warning\"\n  onClick={handleDelete}\n> Delete account\n\u003C\u002Fbutton>\n\u003Cp id=\"delete-warning\">This action cannot be undone.\u003C\u002Fp>\n```\n\n### aria-live for Dynamic Content\n\n```tsx\n\u002F\u002F Use aria-live to announce content that updates without a page reload\n\u002F\u002F polite: waits for user to finish current action before announcing\n\u002F\u002F assertive: interrupts immediately — use only for urgent errors\n\nexport function StatusMessage({ message, isError }: { message: string; isError?: boolean }) {\n  return (\n    \u003Cdiv role=\"status\" aria-live={isError ? 'assertive' : 'polite'} aria-atomic=\"true\">\n      {message}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n### aria-expanded and aria-controls\n\n```tsx\nexport function Accordion({ title, children }: { title: string; children: React.ReactNode }) {\n  const [isOpen, setIsOpen] = useState(false);\n  const contentId = useId();\n\n  return (\n    \u003Cdiv>\n      \u003Cbutton aria-expanded={isOpen} aria-controls={contentId} onClick={() => setIsOpen(prev => !prev)}>\n        {title}\n      \u003C\u002Fbutton>\n      \u003Cdiv id={contentId} hidden={!isOpen}>\n        {children}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Keyboard Navigation\n\nEvery interactive element must be reachable and operable by keyboard alone.\n\n### Custom Dropdown\n\n```tsx\nexport function Dropdown({ options, onSelect }: { options: string[]; onSelect: (value: string) => void }) {\n  const [isOpen, setIsOpen] = useState(false);\n  const [activeIndex, setActiveIndex] = useState(0);\n  const listId = useId();\n\n  if (!options.length) return null;\n\n  const handleKeyDown = (e: React.KeyboardEvent) => {\n    switch (e.key) {\n      case 'ArrowDown':\n        e.preventDefault();\n        setActiveIndex(i => Math.min(i + 1, options.length - 1));\n        break;\n      case 'ArrowUp':\n        e.preventDefault();\n        setActiveIndex(i => Math.max(i - 1, 0));\n        break;\n      case 'Enter':\n      case ' ':\n        e.preventDefault();\n        if (isOpen) onSelect(options[activeIndex]);\n        setIsOpen(prev => !prev);\n        break;\n      case 'Escape':\n        setIsOpen(false);\n        break;\n    }\n  };\n\n  return (\n    \u003Cdiv\n      role=\"combobox\"\n      aria-expanded={isOpen}\n      aria-haspopup=\"listbox\"\n      aria-controls={listId}\n      tabIndex={0}\n      onKeyDown={handleKeyDown}\n      onClick={() => setIsOpen(prev => !prev)}\n    >\n      \u003Cspan>{options[activeIndex]}\u003C\u002Fspan>\n      {isOpen && (\n        \u003Cul id={listId} role=\"listbox\">\n          {options.map((option, index) => (\n            \u003Cli\n              key={option}\n              role=\"option\"\n              aria-selected={index === activeIndex}\n              onClick={() => {\n                onSelect(option);\n                setIsOpen(false);\n              }}\n            >\n              {option}\n            \u003C\u002Fli>\n          ))}\n        \u003C\u002Ful>\n      )}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Focus Management\n\nFocus must move logically when UI state changes — especially for modals and route transitions.\n\n### Modal Focus Restoration\n\n> This example covers initial focus and restoration. For a full focus trap (Tab\u002FShift+Tab cycling within the modal), use a library like [`focus-trap-react`](https:\u002F\u002Fgithub.com\u002Ffocus-trap\u002Ffocus-trap-react) which handles edge cases like dynamic content and nested portals.\n\n```tsx\nexport function Modal({ isOpen, onClose, title, children }: { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode }) {\n  const modalRef = useRef\u003CHTMLDivElement>(null);\n  const previousFocusRef = useRef\u003CHTMLElement | null>(null);\n\n  useEffect(() => {\n    if (isOpen) {\n      \u002F\u002F Save currently focused element and move focus into modal\n      previousFocusRef.current = document.activeElement as HTMLElement;\n      modalRef.current?.focus();\n    } else {\n      \u002F\u002F Restore focus to the element that opened the modal\n      previousFocusRef.current?.focus();\n    }\n  }, [isOpen]);\n\n  if (!isOpen) return null;\n\n  return (\n    \u003Cdiv ref={modalRef} role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"modal-title\" tabIndex={-1} onKeyDown={e => e.key === 'Escape' && onClose()}>\n      \u003Ch2 id=\"modal-title\">{title}\u003C\u002Fh2>\n      {children}\n      \u003Cbutton onClick={onClose}>Close\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Images and Icons\n\n```tsx\n\u002F\u002F BAD: decorative icon announced as unlabeled image\n\u003Cimg src=\"\u002Ficon.svg\" \u002F>\n\n\u002F\u002F GOOD: decorative image hidden from screen readers\n\u003Cimg src=\"\u002Fdecoration.png\" alt=\"\" aria-hidden=\"true\" \u002F>\n\n\u002F\u002F GOOD: meaningful image with descriptive alt text\n\u003Cimg src=\"\u002Fchart.png\" alt=\"Monthly revenue increased 23% from January to March\" \u002F>\n\n\u002F\u002F GOOD: icon button with accessible label\n\u003Cbutton aria-label=\"Delete item\">\n  \u003CTrashIcon aria-hidden=\"true\" \u002F>\n\u003C\u002Fbutton>\n```\n\n## Reduced Motion\n\nRespect users who have requested reduced motion in their OS settings.\n\n```tsx\nexport function useReducedMotion(): boolean {\n  const [prefersReduced, setPrefersReduced] = useState(false);\n\n  useEffect(() => {\n    const mq = window.matchMedia('(prefers-reduced-motion: reduce)');\n    setPrefersReduced(mq.matches);\n    const handler = (e: MediaQueryListEvent) => setPrefersReduced(e.matches);\n    mq.addEventListener('change', handler);\n    return () => mq.removeEventListener('change', handler);\n  }, []);\n\n  return prefersReduced;\n}\n\n\u002F\u002F Usage\nexport function AnimatedCard({ children }: { children: React.ReactNode }) {\n  const reduceMotion = useReducedMotion();\n\n  return (\n    \u003Cdiv\n      style={{\n        transition: reduceMotion ? 'none' : 'transform 300ms ease'\n      }}\n    >\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Anti-Patterns\n\n```tsx\n\u002F\u002F BAD: onClick on non-interactive element with no keyboard support\n\u003Cdiv onClick={handleClick}>Click me\u003C\u002Fdiv>\n\n\u002F\u002F BAD: aria-label on a div that has no role\n\u003Cdiv aria-label=\"Navigation\">...\u003C\u002Fdiv>\n\n\u002F\u002F BAD: placeholder used as a substitute for label\n\u003Cinput placeholder=\"Enter your email\" \u002F>\n\n\u002F\u002F BAD: positive tabIndex creates unpredictable tab order\n\u003Cbutton tabIndex={3}>Submit\u003C\u002Fbutton>\n\n\u002F\u002F BAD: aria-hidden on a focusable element — keyboard users get trapped\n\u003Cbutton aria-hidden=\"true\">Open\u003C\u002Fbutton>\n\n\u002F\u002F BAD: role=\"button\" on div without keyboard handler\n\u003Cdiv role=\"button\" onClick={handleClick}>Submit\u003C\u002Fdiv>\n\u002F\u002F Missing: tabIndex={0}, onKeyDown for Enter\u002FSpace\n```\n\n## Checklist\n\nBefore submitting any interactive component for review:\n\n- [ ] Every `\u003Cinput>`, `\u003Cselect>`, and `\u003Ctextarea>` has a connected `\u003Clabel>` via `htmlFor`\u002F`id`\n- [ ] Error messages are linked with `aria-describedby` and marked `role=\"alert\"`\n- [ ] No `onClick` on `\u003Cdiv>` or `\u003Cspan>` without `role`, `tabIndex`, and `onKeyDown`\n- [ ] Icon-only buttons have `aria-label`\n- [ ] Decorative images use `alt=\"\"` and `aria-hidden=\"true\"`\n- [ ] Modals restore focus on close (for full focus trapping with Tab\u002FShift+Tab cycling, use a library like `focus-trap-react`)\n- [ ] Dynamic content updates use `aria-live`\n- [ ] `prefers-reduced-motion` is respected for animations\n\n## Related Skills\n\n- `frontend-patterns` — general React component and state patterns\n- `design-system` — design token and component consistency\n- `motion-foundations` and `motion-patterns`: animation patterns with accessibility considerations\n",{"name":5,"metadata":54,"description":7},{"origin":48},"main","74715deacdc69119d739f38916f8ee4f0f979ebf","skills\u002Fstorage\u002Faffaan-m_ECC\u002Ffrontend-a11y",0,"https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills","https:\u002F\u002Fgithub.com\u002Fmdnaimul22","AI Agents Workflows Automation | Specializing in Python, FastAPI, MCP Agents & Custom ERP.","2026-11-11 21:16:57",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add mdnaimul22\u002Fhuman-skills --skill frontend-a11y",{"tool":69,"command":70},"bunx","bunx skills add mdnaimul22\u002Fhuman-skills --skill frontend-a11y",{"tool":72,"command":73},"pnpm","pnpm dlx skills add mdnaimul22\u002Fhuman-skills --skill frontend-a11y","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ffrontend-a11y\u002FSKILL.md",true,[],[78,86,94,101,108,115],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":85},"01M767791C1KRP2ZRW2Z73VZ5Q","system-lifecycle-designer","Universal architectural methodology for designing granular, atomic, and sub-atomic lifecycles and end-to-end workflows for single functionality integrations across any domain (daemons, batch jobs, request transactions, resource pools). Provides patterns for deterministic identity, pre-commit validation, differential reconciliation, sticky leasing, state machines, transactional persistence, and closed-loop feedback.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":93},"01M748ABPN5F1FANHH6HKZQMXT","style-sampling","Make a new episode in a proven video style - Collage Explainer, Finance Explainer, Animated Science Explainer, 3D Brand Explainer, 3D True Crime - on the person's topic. Use for \"an episode of\", \"in the style of\", \"sample this style\", 「用这个风格做一集」. One video to copy is reverse-any-video.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Fstyle-sampling\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":93},"01M748A59V04PKW4HA0XQ81FGP","reverse-any-video","Rebuild any video file as an editable HyperFrames project - motion graphics, talking heads, live action or AI-generated footage - checked against the original frame by frame. Use to reverse, recreate, remake, replicate or copy a video, or 「复刻这个视频」「照着这个视频做一个」.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Freverse-any-video\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":93},"01M7487T50P55CSXMWXZ0G9KRG","typescript-patterns","TypeScript patterns for strict, type-safe, maintainable code in modern TypeScript and JavaScript applications. Covers strict compiler configuration, type design, narrowing, discriminated unions, generics, async and error handling, module boundaries, dependency hygiene, and type-level testing. Use when writing or reviewing TypeScript or JavaScript code.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftypescript-patterns\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":93},"01M7487ERZRGPC5NJ75077Y238","test-collaboration","Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing test registry or TESTS.md. Use for test inventory, test gap analysis, unit\u002Fintegration\u002Fcontract\u002FE2E\u002Fsmoke classification, bug-to-test regression protection, consumer\u002Fprovider contract testing, test-necessity review, and pre-delivery evidence review.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftest-collaboration\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":93},"01M748721J3GKR2WS6K0QWFC35","story-lifecycle","Manage a file-based epic → story → sprint development loop without requiring an external project management tool. Creates and tracks epics, breaks them into user stories, assigns them to sprints, and drives implementation story by story. Use when starting a new feature initiative or when the team has no Jira\u002FLinear\u002FTaiga but needs structured delivery tracking.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fstory-lifecycle\u002FSKILL.md",[],[]]