CommandOpen
aria-fix
Fix ARIA attributes and accessibility issues in web components.
Front matter
name: aria-fix
description: Fix ARIA attributes and accessibility issues in web components.Fix ARIA attributes and accessibility issues in web components.
Steps
- Read the target component and identify accessibility issues.
- Apply ARIA fixes by category:
- Roles: Add
roleattributes to custom interactive elements. - States: Add
aria-expanded,aria-selected,aria-checkedfor stateful components. - Properties: Add
aria-label,aria-describedby,aria-labelledby. - Live regions: Add
aria-livefor dynamic content updates.
- Fix interactive element accessibility:
- Add
tabIndex={0}to custom interactive elements. - Add keyboard event handlers (
onKeyDownfor Enter/Space). - Ensure focus is visible with proper styling.
- Trap focus in modal dialogs.
- Fix form accessibility:
- Associate labels with inputs.
- Add
aria-invalidandaria-describedbyfor validation errors. - Group related fields with
fieldsetandlegend.
- Fix semantic HTML:
- Replace
divclick handlers withbuttonelements. - Use proper heading hierarchy (h1 > h2 > h3).
- Use landmark elements (nav, main, aside, footer).
- Verify fixes do not break existing functionality.
Format
ARIA Fixes Applied: <file>
Changes:
- L<N>: Added role="button" and keyboard handler to clickable div
- L<N>: Added aria-label="Close dialog" to icon button
- L<N>: Added aria-live="polite" to status message container
- L<N>: Replaced div with semantic <nav> element
Tests: verify with keyboard navigation and screen readerRules
- Prefer semantic HTML over ARIA attributes (a button over div with role=button).
- Never use
aria-hidden="true"on focusable elements. - Ensure every ARIA role has the required states and properties.
- Test keyboard navigation order matches visual order.
- Do not add ARIA attributes that duplicate native HTML semantics.
Author: rohitg00, Claude Code toolkit (rohitg00). License: Apache-2.0.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.