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
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---
2name: fixing-accessibility
3description: Audit and fix HTML accessibility issues including ARIA labels, keyboard navigation, focus management, color contrast, and form errors. Use when adding interactive controls, forms, dialogs, or reviewing WCAG compliance.
4risk: unknown
5source: community
6metadata:
7 source: https://skillmd.com/skills/arjumaan/fixing-accessibility
8---
9
10# fixing-accessibility
11
12Fix accessibility issues.
13
14## how to use
15
16- `/fixing-accessibility`
17 Apply these constraints to any UI work in this conversation.
18
19- `/fixing-accessibility <file>`
20 Review the file against all rules below and report:
21 - violations (quote the exact line or snippet)
22 - why it matters (one short sentence)
23 - a concrete fix (code-level suggestion)
24
25Do not rewrite large parts of the UI. Prefer minimal, targeted fixes.
26
27## When to Use
28Reference these guidelines when:
29- adding or changing buttons, links, inputs, menus, dialogs, tabs, dropdowns
30- building forms, validation, error states, helper text
31- implementing keyboard shortcuts or custom interactions
32- working on focus states, focus trapping, or modal behavior
33- rendering icon-only controls
34- adding hover-only interactions or hidden content
35
36## rule categories by priority
37
38| priority | category | impact |
39|----------|----------|--------|
40| 1 | accessible names | critical |
41| 2 | keyboard access | critical |
42| 3 | focus and dialogs | critical |
43| 4 | semantics | high |
44| 5 | forms and errors | high |
45| 6 | announcements | medium-high |
46| 7 | contrast and states | medium |
47| 8 | media and motion | low-medium |
48| 9 | tool boundaries | critical |
49
50## quick reference
51
52### 1. accessible names (critical)
53
54- every interactive control must have an accessible name
55- icon-only buttons must have aria-label or aria-labelledby
56- every input, select, and textarea must be labeled
57- links must have meaningful text (no “click here”)
58- decorative icons must be aria-hidden
59
60### 2. keyboard access (critical)
61
62- do not use div or span as buttons without full keyboard support
63- all interactive elements must be reachable by Tab
64- focus must be visible for keyboard users
65- do not use tabindex greater than 0
66- Escape must close dialogs or overlays when applicable
67
68### 3. focus and dialogs (critical)
69
70- modals must trap focus while open
71- restore focus to the trigger on close
72- set initial focus inside dialogs
73- opening a dialog should not scroll the page unexpectedly
74
75### 4. semantics (high)
76
77- prefer native elements (button, a, input) over role-based hacks
78- if a role is used, required aria attributes must be present
79- lists must use ul or ol with li
80- do not skip heading levels
81- tables must use th for headers when applicable
82
83### 5. forms and errors (high)
84
85- errors must be linked to fields using aria-describedby
86- required fields must be announced
87- invalid fields must set aria-invalid
88- helper text must be associated with inputs
89- disabled submit actions must explain why
90
91### 6. announcements (medium-high)
92
93- critical form errors should use aria-live
94- loading states should use aria-busy or status text
95- toasts must not be the only way to convey critical information
96- expandable controls must use aria-expanded and aria-controls
97
98### 7. contrast and states (medium)
99
100- ensure sufficient contrast for text and icons
101- hover-only interactions must have keyboard equivalents
102- disabled states must not rely on color alone
103- do not remove focus outlines without a visible replacement
104
105### 8. media and motion (low-medium)
106
107- images must have correct alt text (meaningful or empty)
108- videos with speech should provide captions when relevant
109- respect prefers-reduced-motion for non-essential motion
110- avoid autoplaying media with sound
111
112### 9. tool boundaries (critical)
113
114- prefer minimal changes, do not refactor unrelated code
115- do not add aria when native semantics already solve the problem
116- do not migrate UI libraries unless requested
117
118## common fixes
119
120```html
121<!-- icon-only button: add aria-label -->
122<!-- before --> <button><svg>...</svg></button>
123<!-- after --> <button aria-label="Close"><svg aria-hidden="true">...</svg></button>
124
125<!-- div as button: use native element -->
126<!-- before --> <div onclick="save()">Save</div>
127<!-- after --> <button onclick="save()">Save</button>
128
129<!-- form error: link with aria-describedby -->
130<!-- before --> <input id="email" /> <span>Invalid email</span>
131<!-- after --> <input id="email" aria-describedby="email-err" aria-invalid="true" /> <span id="email-err">Invalid email</span>
132```
133
134## review guidance
135
136- fix critical issues first (names, keyboard, focus, tool boundaries)
137- prefer native HTML before adding aria
138- quote the exact snippet, state the failure, propose a small fix
139- for complex widgets (menu, dialog, combobox), prefer established accessible primitives over custom behavior
140
141## Limitations
142- Use this skill only when the task clearly matches the scope described above.
143- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
144- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.