fixing-accessibility
Fix accessibility issues.
how to use
Do not rewrite large parts of the UI. Prefer minimal, targeted fixes.
When to Use
Reference these guidelines when:
- adding or changing buttons, links, inputs, menus, dialogs, tabs, dropdowns
- building forms, validation, error states, helper text
- implementing keyboard shortcuts or custom interactions
- working on focus states, focus trapping, or modal behavior
- rendering icon-only controls
- adding hover-only interactions or hidden content
rule categories by priority
| priority |
category |
impact |
| 1 |
accessible names |
critical |
| 2 |
keyboard access |
critical |
| 3 |
focus and dialogs |
critical |
| 4 |
semantics |
high |
| 5 |
forms and errors |
high |
| 6 |
announcements |
medium-high |
| 7 |
contrast and states |
medium |
| 8 |
media and motion |
low-medium |
| 9 |
tool boundaries |
critical |
quick reference
1. accessible names (critical)
- every interactive control must have an accessible name
- icon-only buttons must have aria-label or aria-labelledby
- every input, select, and textarea must be labeled
- links must have meaningful text (no “click here”)
- decorative icons must be aria-hidden
2. keyboard access (critical)
- do not use div or span as buttons without full keyboard support
- all interactive elements must be reachable by Tab
- focus must be visible for keyboard users
- do not use tabindex greater than 0
- Escape must close dialogs or overlays when applicable
3. focus and dialogs (critical)
- modals must trap focus while open
- restore focus to the trigger on close
- set initial focus inside dialogs
- opening a dialog should not scroll the page unexpectedly
4. semantics (high)
- prefer native elements (button, a, input) over role-based hacks
- if a role is used, required aria attributes must be present
- lists must use ul or ol with li
- do not skip heading levels
- tables must use th for headers when applicable
5. forms and errors (high)
- errors must be linked to fields using aria-describedby
- required fields must be announced
- invalid fields must set aria-invalid
- helper text must be associated with inputs
- disabled submit actions must explain why
6. announcements (medium-high)
- critical form errors should use aria-live
- loading states should use aria-busy or status text
- toasts must not be the only way to convey critical information
- expandable controls must use aria-expanded and aria-controls
7. contrast and states (medium)
- ensure sufficient contrast for text and icons
- hover-only interactions must have keyboard equivalents
- disabled states must not rely on color alone
- do not remove focus outlines without a visible replacement
8. media and motion (low-medium)
- images must have correct alt text (meaningful or empty)
- videos with speech should provide captions when relevant
- respect prefers-reduced-motion for non-essential motion
- avoid autoplaying media with sound
9. tool boundaries (critical)
- prefer minimal changes, do not refactor unrelated code
- do not add aria when native semantics already solve the problem
- do not migrate UI libraries unless requested
common fixes
<!-- icon-only button: add aria-label -->
<!-- before --> <button><svg>...</svg></button>
<!-- after --> <button aria-label="Close"><svg aria-hidden="true">...</svg></button>
<!-- div as button: use native element -->
<!-- before --> <div
<!-- after --> <button
<!-- form error: link with aria-describedby -->
<!-- before --> <input id="email" /> <span>Invalid email</span>
<!-- after --> <input id="email" aria-describedby="email-err" aria-invalid="true" /> <span id="email-err">Invalid email</span>
review guidance
- fix critical issues first (names, keyboard, focus, tool boundaries)
- prefer native HTML before adding aria
- quote the exact snippet, state the failure, propose a small fix
- for complex widgets (menu, dialog, combobox), prefer established accessible primitives over custom behavior
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
1---2name: fixing-accessibility3description: Audit and fix HTML accessibility issues including ARIA labels, keyboard4 navigation, focus management, color contrast, and form errors. Use when adding interactive5 controls, forms, dialogs, or reviewing WCAG compliance.6risk: safe7source: community8license: MIT9metadata:10 source: https://skillmd.com/skills/jantoniofc/fixing-accessibility11---1213# fixing-accessibility1415Fix accessibility issues.1617## how to use1819- `/fixing-accessibility`20 Apply these constraints to any UI work in this conversation.2122- `/fixing-accessibility <file>`23 Review the file against all rules below and report:24 - violations (quote the exact line or snippet)25 - why it matters (one short sentence)26 - a concrete fix (code-level suggestion)2728Do not rewrite large parts of the UI. Prefer minimal, targeted fixes.2930## When to Use31Reference these guidelines when:32- adding or changing buttons, links, inputs, menus, dialogs, tabs, dropdowns33- building forms, validation, error states, helper text34- implementing keyboard shortcuts or custom interactions35- working on focus states, focus trapping, or modal behavior36- rendering icon-only controls37- adding hover-only interactions or hidden content3839## rule categories by priority4041| priority | category | impact |42|----------|----------|--------|43| 1 | accessible names | critical |44| 2 | keyboard access | critical |45| 3 | focus and dialogs | critical |46| 4 | semantics | high |47| 5 | forms and errors | high |48| 6 | announcements | medium-high |49| 7 | contrast and states | medium |50| 8 | media and motion | low-medium |51| 9 | tool boundaries | critical |5253## quick reference5455### 1. accessible names (critical)5657- every interactive control must have an accessible name58- icon-only buttons must have aria-label or aria-labelledby59- every input, select, and textarea must be labeled60- links must have meaningful text (no “click here”)61- decorative icons must be aria-hidden6263### 2. keyboard access (critical)6465- do not use div or span as buttons without full keyboard support66- all interactive elements must be reachable by Tab67- focus must be visible for keyboard users68- do not use tabindex greater than 069- Escape must close dialogs or overlays when applicable7071### 3. focus and dialogs (critical)7273- modals must trap focus while open74- restore focus to the trigger on close75- set initial focus inside dialogs76- opening a dialog should not scroll the page unexpectedly7778### 4. semantics (high)7980- prefer native elements (button, a, input) over role-based hacks81- if a role is used, required aria attributes must be present82- lists must use ul or ol with li83- do not skip heading levels84- tables must use th for headers when applicable8586### 5. forms and errors (high)8788- errors must be linked to fields using aria-describedby89- required fields must be announced90- invalid fields must set aria-invalid91- helper text must be associated with inputs92- disabled submit actions must explain why9394### 6. announcements (medium-high)9596- critical form errors should use aria-live97- loading states should use aria-busy or status text98- toasts must not be the only way to convey critical information99- expandable controls must use aria-expanded and aria-controls100101### 7. contrast and states (medium)102103- ensure sufficient contrast for text and icons104- hover-only interactions must have keyboard equivalents105- disabled states must not rely on color alone106- do not remove focus outlines without a visible replacement107108### 8. media and motion (low-medium)109110- images must have correct alt text (meaningful or empty)111- videos with speech should provide captions when relevant112- respect prefers-reduced-motion for non-essential motion113- avoid autoplaying media with sound114115### 9. tool boundaries (critical)116117- prefer minimal changes, do not refactor unrelated code118- do not add aria when native semantics already solve the problem119- do not migrate UI libraries unless requested120121## common fixes122123```html124<!-- icon-only button: add aria-label -->125<!-- before --> <button><svg>...</svg></button>126<!-- after --> <button aria-label="Close"><svg aria-hidden="true">...</svg></button>127128<!-- div as button: use native element -->129<!-- before --> <div onclick="save()">Save</div>130<!-- after --> <button onclick="save()">Save</button>131132<!-- form error: link with aria-describedby -->133<!-- before --> <input id="email" /> <span>Invalid email</span>134<!-- after --> <input id="email" aria-describedby="email-err" aria-invalid="true" /> <span id="email-err">Invalid email</span>135```136137## review guidance138139- fix critical issues first (names, keyboard, focus, tool boundaries)140- prefer native HTML before adding aria141- quote the exact snippet, state the failure, propose a small fix142- for complex widgets (menu, dialog, combobox), prefer established accessible primitives over custom behavior143144## When to Use145This skill is applicable to execute the workflow or actions described in the overview.