[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F02KT3GKGVJ8ATRVDWHJSB":3,"skill-same:01M7F02KT3GKGVJ8ATRVDWHJSB":46},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7F02KT3GKGVJ8ATRVDWHJSB","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.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fecc\u002Ffrontend-a11y\u002FSKILL.md",[],[],"2026-11-16 10:05:34",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":24,"description":7},{"origin":25},"community","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fecc\u002Ffrontend-a11y","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill frontend-a11y",{"tool":38,"command":39},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill frontend-a11y",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill frontend-a11y","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fecc\u002Ffrontend-a11y\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]