gbu-accessibility-package 3.0.0 โ 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -0
- package/README-vi.md +720 -0
- package/README.md +394 -119
- package/cli.js +6 -6
- package/demo/no-backup-test.html +12 -0
- package/demo/no-backup-test.html.backup +12 -0
- package/lib/fixer.js +1 -1
- package/package.json +19 -5
package/README.md
CHANGED
|
@@ -12,9 +12,14 @@
|
|
|
12
12
|
- ๐ท๏ธ **Aria Label Support** - Automatic aria-label matching alt text
|
|
13
13
|
- ๐ **HTML Lang Attributes** - Automatic language attribute fixes
|
|
14
14
|
- ๐ญ **Role Attributes** - WCAG-compliant role attribute management
|
|
15
|
+
- ๐ **Form Labels** - Fix missing labels with intelligent aria-label generation
|
|
16
|
+
- ๐ **Button Names** - Fix empty buttons and input buttons without names
|
|
17
|
+
- ๐ **Link Names** - Fix empty links and detect generic link text
|
|
18
|
+
- ๐๏ธ **Landmarks** - Add missing main and navigation landmarks
|
|
19
|
+
- ๐ **Heading Analysis** - Analyze heading structure with suggestions (no auto-fix)
|
|
15
20
|
- ๐งน **Duplicate Cleanup** - Remove duplicate role attributes
|
|
16
21
|
- ๐ **Batch Processing** - Process entire directories recursively
|
|
17
|
-
- ๐พ **
|
|
22
|
+
- ๐พ **Optional Backups** - Create backup files when needed with --backup flag
|
|
18
23
|
- ๐ **Dry Run Mode** - Preview changes before applying
|
|
19
24
|
- ๐ **Detailed Reports** - Comprehensive fix summaries
|
|
20
25
|
|
|
@@ -56,24 +61,29 @@ gbu-a11y [options] [directory/file]
|
|
|
56
61
|
Options:
|
|
57
62
|
-d, --directory <path> Target directory (default: current directory)
|
|
58
63
|
-l, --language <lang> Language for lang attribute (default: ja)
|
|
59
|
-
--backup Create backup files
|
|
60
|
-
--no-backup Don't create backup files
|
|
64
|
+
--backup Create backup files
|
|
65
|
+
--no-backup Don't create backup files (default)
|
|
61
66
|
--dry-run Preview changes without applying
|
|
62
67
|
--comprehensive, --all Run comprehensive fixes (same as default)
|
|
63
68
|
--cleanup-only Only cleanup duplicate role attributes
|
|
64
69
|
--alt-only Fix alt attributes + cleanup
|
|
65
70
|
--lang-only Fix HTML lang attributes + cleanup
|
|
66
71
|
--role-only Fix role attributes + cleanup
|
|
72
|
+
--forms-only Fix form labels + cleanup
|
|
73
|
+
--buttons-only Fix button names + cleanup
|
|
74
|
+
--links-only Fix link names + cleanup
|
|
75
|
+
--landmarks-only Fix landmarks + cleanup
|
|
76
|
+
--headings-only Analyze heading structure (no auto-fix)
|
|
67
77
|
-h, --help Show help message
|
|
68
78
|
```
|
|
69
79
|
|
|
70
80
|
### Examples
|
|
71
81
|
|
|
72
82
|
```bash
|
|
73
|
-
#
|
|
83
|
+
# Comprehensive fixes (default - includes cleanup)
|
|
74
84
|
gbu-a11y
|
|
75
85
|
|
|
76
|
-
# Preview all changes
|
|
86
|
+
# Preview all changes
|
|
77
87
|
gbu-a11y --dry-run
|
|
78
88
|
|
|
79
89
|
# Fix with English language
|
|
@@ -81,37 +91,40 @@ gbu-a11y -l en ./public
|
|
|
81
91
|
|
|
82
92
|
# Individual fix types (all include cleanup)
|
|
83
93
|
gbu-a11y --alt-only # Fix alt attributes + cleanup
|
|
84
|
-
gbu-a11y --
|
|
85
|
-
gbu-a11y --
|
|
94
|
+
gbu-a11y --forms-only # Fix form labels + cleanup
|
|
95
|
+
gbu-a11y --buttons-only # Fix button names + cleanup
|
|
96
|
+
gbu-a11y --links-only # Fix link names + cleanup
|
|
97
|
+
gbu-a11y --landmarks-only # Fix landmarks + cleanup
|
|
98
|
+
gbu-a11y --headings-only # Analyze heading structure
|
|
86
99
|
gbu-a11y --cleanup-only # Only cleanup duplicates
|
|
87
100
|
|
|
88
101
|
# Combine with other options
|
|
89
102
|
gbu-a11y --alt-only --dry-run ./src # Preview alt fixes + cleanup
|
|
90
|
-
gbu-a11y --
|
|
103
|
+
gbu-a11y --forms-only -l en ./public # Form fixes + cleanup with English lang
|
|
91
104
|
|
|
92
105
|
# Backup options
|
|
93
|
-
gbu-a11y --backup ./dist #
|
|
94
|
-
gbu-a11y --no-backup ./dist # Disable backups
|
|
106
|
+
gbu-a11y --backup ./dist # Enable backups for safety
|
|
107
|
+
gbu-a11y --no-backup ./dist # Disable backups (default - faster processing)
|
|
95
108
|
```
|
|
96
109
|
|
|
97
110
|
## ๐ง Programmatic Usage
|
|
98
111
|
|
|
99
112
|
```javascript
|
|
100
|
-
const AccessibilityFixer = require(
|
|
113
|
+
const AccessibilityFixer = require('gbu-accessibility-package');
|
|
101
114
|
|
|
102
115
|
const fixer = new AccessibilityFixer({
|
|
103
|
-
language:
|
|
116
|
+
language: 'en',
|
|
104
117
|
backupFiles: true,
|
|
105
|
-
dryRun: false
|
|
118
|
+
dryRun: false
|
|
106
119
|
});
|
|
107
120
|
|
|
108
121
|
// Fix all accessibility issues
|
|
109
122
|
async function fixAccessibility() {
|
|
110
123
|
try {
|
|
111
|
-
const results = await fixer.fixAllAccessibilityIssues(
|
|
112
|
-
console.log(
|
|
124
|
+
const results = await fixer.fixAllAccessibilityIssues('./src');
|
|
125
|
+
console.log('Fixed files:', results);
|
|
113
126
|
} catch (error) {
|
|
114
|
-
console.error(
|
|
127
|
+
console.error('Error:', error);
|
|
115
128
|
}
|
|
116
129
|
}
|
|
117
130
|
|
|
@@ -120,75 +133,63 @@ fixAccessibility();
|
|
|
120
133
|
|
|
121
134
|
## ๐ฏ Fix Modes
|
|
122
135
|
|
|
123
|
-
###
|
|
124
|
-
|
|
125
|
-
You can now fix specific accessibility issues individually:
|
|
126
|
-
|
|
127
|
-
- `--alt-only` - Only fix alt attributes for images
|
|
128
|
-
- `--lang-only` - Only fix HTML lang attributes
|
|
129
|
-
- `--role-only` - Only fix role attributes
|
|
130
|
-
- `--cleanup-only` - Only cleanup duplicate role attributes
|
|
136
|
+
### Comprehensive Mode (Default)
|
|
137
|
+
Runs all fixes including cleanup:
|
|
131
138
|
|
|
132
|
-
|
|
139
|
+
1. **HTML lang attributes** - Adds missing language attributes
|
|
140
|
+
2. **Alt attributes** - Generates contextual alt text + aria-label
|
|
141
|
+
3. **Role attributes** - Adds appropriate ARIA roles + picture handling
|
|
142
|
+
4. **Form labels** - Fixes missing input labels
|
|
143
|
+
5. **Button names** - Fixes empty buttons
|
|
144
|
+
6. **Link names** - Fixes empty links and detects generic text
|
|
145
|
+
7. **Landmarks** - Adds main and navigation landmarks
|
|
146
|
+
8. **Heading analysis** - Analyzes structure (suggestions only)
|
|
147
|
+
9. **Cleanup** - Removes duplicate role attributes
|
|
133
148
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Fix only missing alt attributes
|
|
139
|
-
gbu-a11y --alt-only
|
|
140
|
-
|
|
141
|
-
# Fix only HTML lang attributes
|
|
142
|
-
gbu-a11y --lang-only
|
|
143
|
-
|
|
144
|
-
# Fix only role attributes
|
|
145
|
-
gbu-a11y --role-only
|
|
146
|
-
|
|
147
|
-
# Clean up duplicate roles only
|
|
148
|
-
gbu-a11y --cleanup-only
|
|
149
|
+
### Individual Fix Options
|
|
150
|
+
Each individual mode includes cleanup step:
|
|
149
151
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
- `--alt-only` - Alt attributes + cleanup
|
|
153
|
+
- `--forms-only` - Form labels + cleanup
|
|
154
|
+
- `--buttons-only` - Button names + cleanup
|
|
155
|
+
- `--links-only` - Link names + cleanup
|
|
156
|
+
- `--landmarks-only` - Landmarks + cleanup
|
|
157
|
+
- `--headings-only` - Heading analysis only (no cleanup)
|
|
153
158
|
|
|
154
159
|
## ๐ง What Gets Fixed
|
|
155
160
|
|
|
156
|
-
### 1. Alt Attributes
|
|
157
|
-
|
|
161
|
+
### 1. Alt Attributes & Aria Labels
|
|
158
162
|
- **Missing alt attributes** โ Adds contextual alt text
|
|
159
163
|
- **Empty alt attributes** โ Generates meaningful descriptions
|
|
164
|
+
- **Automatic aria-label** โ Adds aria-label matching alt text
|
|
160
165
|
- **Context-aware generation** โ Uses surrounding text, headings, captions
|
|
161
166
|
|
|
162
167
|
```html
|
|
163
168
|
<!-- Before -->
|
|
164
|
-
<img src="logo.png"
|
|
165
|
-
<img src="chart.jpg" alt=""
|
|
169
|
+
<img src="logo.png">
|
|
170
|
+
<img src="chart.jpg" alt="">
|
|
166
171
|
|
|
167
172
|
<!-- After -->
|
|
168
|
-
<img src="logo.png" alt="ใญใด"
|
|
169
|
-
<img src="chart.jpg" alt="ใฐใฉใ"
|
|
173
|
+
<img src="logo.png" alt="ใญใด" role="img" aria-label="ใญใด">
|
|
174
|
+
<img src="chart.jpg" alt="ใฐใฉใ" role="img" aria-label="ใฐใฉใ">
|
|
170
175
|
```
|
|
171
176
|
|
|
172
177
|
### 2. HTML Lang Attributes
|
|
173
|
-
|
|
174
178
|
- **Missing lang attributes** โ Adds specified language
|
|
175
179
|
- **Empty lang attributes** โ Sets proper language code
|
|
176
180
|
|
|
177
181
|
```html
|
|
178
182
|
<!-- Before -->
|
|
179
183
|
<html>
|
|
180
|
-
|
|
181
|
-
<!-- After -->
|
|
182
|
-
<html lang="ja">
|
|
183
|
-
<html lang="ja"></html>
|
|
184
|
-
</html>
|
|
185
|
-
</html>
|
|
186
|
-
</html>
|
|
187
|
-
```
|
|
184
|
+
<html lang="">
|
|
188
185
|
|
|
189
|
-
|
|
186
|
+
<!-- After -->
|
|
187
|
+
<html lang="ja">
|
|
188
|
+
<html lang="ja">
|
|
189
|
+
```
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
### 3. Role Attributes
|
|
192
|
+
- **Images** โ `role="img"`
|
|
192
193
|
- **Picture elements** โ Moves `role="img"` from `<picture>` to `<img>` inside
|
|
193
194
|
- **Links** โ `role="link"`
|
|
194
195
|
- **Clickable elements** โ `role="button"`
|
|
@@ -197,48 +198,109 @@ gbu-a11y --comprehensive
|
|
|
197
198
|
|
|
198
199
|
```html
|
|
199
200
|
<!-- Before -->
|
|
200
|
-
<img src="icon.png" alt="Icon"
|
|
201
|
+
<img src="icon.png" alt="Icon">
|
|
201
202
|
<picture role="img">
|
|
202
|
-
<img src="photo.jpg" alt="Photo"
|
|
203
|
+
<img src="photo.jpg" alt="Photo">
|
|
203
204
|
</picture>
|
|
204
205
|
<a href="/home">Home</a>
|
|
205
206
|
<div class="btn-click">Click me</div>
|
|
206
207
|
|
|
207
208
|
<!-- After -->
|
|
208
|
-
<img src="icon.png" alt="Icon" role="img" aria-label="Icon"
|
|
209
|
+
<img src="icon.png" alt="Icon" role="img" aria-label="Icon">
|
|
209
210
|
<picture>
|
|
210
|
-
<img src="photo.jpg" alt="Photo" role="img" aria-label="Photo"
|
|
211
|
+
<img src="photo.jpg" alt="Photo" role="img" aria-label="Photo">
|
|
211
212
|
</picture>
|
|
212
213
|
<a href="/home" role="link">Home</a>
|
|
213
214
|
<div class="btn-click" role="button">Click me</div>
|
|
214
215
|
```
|
|
215
216
|
|
|
216
|
-
### 4.
|
|
217
|
+
### 4. Form Labels
|
|
218
|
+
- **Input elements without labels** โ Adds appropriate `aria-label`
|
|
219
|
+
- **Supports multiple input types** โ text, email, password, tel, etc.
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<!-- Before -->
|
|
223
|
+
<input type="text" placeholder="Name">
|
|
224
|
+
<input type="email">
|
|
225
|
+
<input type="password">
|
|
226
|
+
|
|
227
|
+
<!-- After -->
|
|
228
|
+
<input type="text" placeholder="Name" aria-label="ใใญในใๅ
ฅๅ">
|
|
229
|
+
<input type="email" aria-label="ใกใผใซใขใใฌใน">
|
|
230
|
+
<input type="password" aria-label="ใในใฏใผใ">
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 5. Button Names
|
|
234
|
+
- **Empty buttons** โ Adds text content and aria-label
|
|
235
|
+
- **Input buttons without value** โ Adds appropriate value
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<!-- Before -->
|
|
239
|
+
<button></button>
|
|
240
|
+
<input type="submit">
|
|
241
|
+
<input type="button">
|
|
242
|
+
|
|
243
|
+
<!-- After -->
|
|
244
|
+
<button aria-label="ใใฟใณ">ใใฟใณ</button>
|
|
245
|
+
<input type="submit" value="้ไฟก">
|
|
246
|
+
<input type="button" value="ใใฟใณ">
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 6. Link Names
|
|
250
|
+
- **Empty links** โ Adds aria-label
|
|
251
|
+
- **Generic text detection** โ Identifies "Click here", "Read more"
|
|
252
|
+
- **Image-only links** โ Handles links containing only images
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<!-- Before -->
|
|
256
|
+
<a href="/home"></a>
|
|
257
|
+
<a href="/more">Click here</a>
|
|
258
|
+
<a href="/image"><img src="icon.png"></a>
|
|
259
|
+
|
|
260
|
+
<!-- After -->
|
|
261
|
+
<a href="/home" aria-label="ใชใณใฏ">ใชใณใฏ</a>
|
|
262
|
+
<a href="/more">Click here</a> <!-- Detected but not auto-fixed -->
|
|
263
|
+
<a href="/image" aria-label="็ปๅใชใณใฏ"><img src="icon.png"></a>
|
|
264
|
+
```
|
|
217
265
|
|
|
218
|
-
|
|
219
|
-
- **
|
|
220
|
-
- **
|
|
266
|
+
### 7. Landmarks
|
|
267
|
+
- **Missing main landmark** โ Adds `role="main"`
|
|
268
|
+
- **Missing navigation landmark** โ Adds `role="navigation"`
|
|
221
269
|
|
|
222
270
|
```html
|
|
223
271
|
<!-- Before -->
|
|
224
|
-
<
|
|
272
|
+
<div class="content">
|
|
273
|
+
<p>Main content</p>
|
|
274
|
+
</div>
|
|
275
|
+
<ul class="navigation">
|
|
276
|
+
<li><a href="/home">Home</a></li>
|
|
277
|
+
</ul>
|
|
225
278
|
|
|
226
279
|
<!-- After -->
|
|
227
|
-
<
|
|
280
|
+
<div class="content" role="main">
|
|
281
|
+
<p>Main content</p>
|
|
282
|
+
</div>
|
|
283
|
+
<ul class="navigation" role="navigation">
|
|
284
|
+
<li><a href="/home">Home</a></li>
|
|
285
|
+
</ul>
|
|
228
286
|
```
|
|
229
287
|
|
|
230
|
-
###
|
|
288
|
+
### 8. Heading Analysis
|
|
289
|
+
- **Multiple h1 detection** โ Identifies and suggests fixes
|
|
290
|
+
- **Heading level skipping** โ Detects jumps (h1 โ h3)
|
|
291
|
+
- **Empty headings** โ Identifies headings without content
|
|
292
|
+
- **Analysis only** โ Provides suggestions, no auto-fix for content safety
|
|
231
293
|
|
|
232
|
-
|
|
233
|
-
- **
|
|
234
|
-
- **Handles mixed
|
|
294
|
+
### 9. Duplicate Cleanup
|
|
295
|
+
- **Removes duplicate role attributes** โ Keeps first occurrence
|
|
296
|
+
- **Handles mixed quotes** โ role="button" role='button'
|
|
235
297
|
|
|
236
298
|
```html
|
|
237
299
|
<!-- Before -->
|
|
238
|
-
<img src="test.jpg" role="img" role="img" alt="Test"
|
|
300
|
+
<img src="test.jpg" role="img" role="img" alt="Test">
|
|
239
301
|
|
|
240
302
|
<!-- After -->
|
|
241
|
-
<img src="test.jpg" role="img" alt="Test"
|
|
303
|
+
<img src="test.jpg" role="img" alt="Test">
|
|
242
304
|
```
|
|
243
305
|
|
|
244
306
|
## ๐ Smart Alt Text Generation
|
|
@@ -246,9 +308,8 @@ gbu-a11y --comprehensive
|
|
|
246
308
|
The package uses intelligent context analysis to generate meaningful alt text:
|
|
247
309
|
|
|
248
310
|
### Context Sources
|
|
249
|
-
|
|
250
311
|
1. **Title attributes**
|
|
251
|
-
2. **Aria-label attributes**
|
|
312
|
+
2. **Aria-label attributes**
|
|
252
313
|
3. **Definition terms (dt elements)**
|
|
253
314
|
4. **Parent link text**
|
|
254
315
|
5. **Nearby headings**
|
|
@@ -256,7 +317,6 @@ The package uses intelligent context analysis to generate meaningful alt text:
|
|
|
256
317
|
7. **Surrounding text content**
|
|
257
318
|
|
|
258
319
|
### Fallback Patterns
|
|
259
|
-
|
|
260
320
|
- `logo.png` โ "ใญใด" (Logo)
|
|
261
321
|
- `icon.svg` โ "ใขใคใณใณ" (Icon)
|
|
262
322
|
- `banner.jpg` โ "ใใใผ" (Banner)
|
|
@@ -265,98 +325,207 @@ The package uses intelligent context analysis to generate meaningful alt text:
|
|
|
265
325
|
|
|
266
326
|
## ๐ Output Examples
|
|
267
327
|
|
|
268
|
-
###
|
|
269
|
-
|
|
328
|
+
### Comprehensive Mode
|
|
270
329
|
```
|
|
271
330
|
๐ Starting Accessibility Fixer...
|
|
272
|
-
|
|
331
|
+
๐ฏ Running comprehensive accessibility fixes...
|
|
332
|
+
|
|
333
|
+
๐ Step 1: HTML lang attributes...
|
|
273
334
|
โ
Fixed lang attributes in 5 files
|
|
274
335
|
|
|
275
|
-
๐ผ๏ธ Step 2:
|
|
336
|
+
๐ผ๏ธ Step 2: Alt attributes...
|
|
276
337
|
โ
Fixed alt attributes in 12 files (34 issues)
|
|
277
338
|
|
|
278
|
-
๐ญ Step 3:
|
|
339
|
+
๐ญ Step 3: Role attributes...
|
|
279
340
|
โ
Fixed role attributes in 8 files (67 issues)
|
|
280
341
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
Files fixed: 15
|
|
284
|
-
Total issues resolved: 106
|
|
342
|
+
๐ Step 4: Form labels...
|
|
343
|
+
โ
Fixed form labels in 6 files (15 issues)
|
|
285
344
|
|
|
286
|
-
|
|
287
|
-
|
|
345
|
+
๐ Step 5: Button names...
|
|
346
|
+
โ
Fixed button names in 4 files (8 issues)
|
|
288
347
|
|
|
289
|
-
|
|
348
|
+
๐ Step 6: Link names...
|
|
349
|
+
โ
Fixed link names in 7 files (12 issues)
|
|
290
350
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
351
|
+
๐๏ธ Step 7: Landmarks...
|
|
352
|
+
โ
Fixed landmarks in 3 files (5 issues)
|
|
353
|
+
|
|
354
|
+
๐ Step 8: Heading analysis...
|
|
355
|
+
โ
Analyzed headings in 10 files (18 suggestions)
|
|
356
|
+
|
|
357
|
+
๐งน Step 9: Cleanup duplicate roles...
|
|
358
|
+
โ
Cleaned duplicate roles in 2 files
|
|
297
359
|
|
|
298
360
|
๐ All accessibility fixes completed!
|
|
299
361
|
๐ Final Summary:
|
|
300
362
|
Total files scanned: 25
|
|
301
|
-
Files fixed:
|
|
302
|
-
Total issues resolved:
|
|
363
|
+
Files fixed: 20
|
|
364
|
+
Total issues resolved: 164
|
|
303
365
|
```
|
|
304
366
|
|
|
305
367
|
## ๐ Safety Features
|
|
306
368
|
|
|
307
369
|
### Backup Options
|
|
308
|
-
|
|
309
|
-
- **
|
|
310
|
-
- **
|
|
311
|
-
- **Explicit enable**: Use `--backup` to be explicit about backup creation
|
|
370
|
+
- **Default behavior**: No backup files for faster processing
|
|
371
|
+
- **Enable backups**: Use `--backup` for safety when needed
|
|
372
|
+
- **Explicit disable**: Use `--no-backup` to be explicit (same as default)
|
|
312
373
|
|
|
313
374
|
```bash
|
|
314
|
-
#
|
|
375
|
+
# Fast mode (default) - no backups
|
|
315
376
|
gbu-a11y --comprehensive
|
|
316
377
|
|
|
317
|
-
#
|
|
318
|
-
gbu-a11y --no-backup --comprehensive
|
|
319
|
-
|
|
320
|
-
# Explicit backup mode
|
|
378
|
+
# Safe mode - creates backups
|
|
321
379
|
gbu-a11y --backup --comprehensive
|
|
380
|
+
|
|
381
|
+
# Explicit no backup mode (same as default)
|
|
382
|
+
gbu-a11y --no-backup --comprehensive
|
|
322
383
|
```
|
|
323
384
|
|
|
324
385
|
### Other Safety Features
|
|
325
|
-
|
|
326
386
|
- **Dry run mode** for safe previewing with `--dry-run`
|
|
327
387
|
- **Non-destructive** - only adds missing attributes
|
|
328
388
|
- **Duplicate prevention** - won't add existing attributes
|
|
329
389
|
- **Error handling** - continues processing on individual file errors
|
|
330
390
|
|
|
391
|
+
## ๐ง Package Management
|
|
392
|
+
|
|
393
|
+
### Uninstall and Reinstall
|
|
394
|
+
|
|
395
|
+
If you encounter issues or want to update to the latest version:
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Uninstall global package
|
|
399
|
+
npm uninstall -g gbu-accessibility-package
|
|
400
|
+
|
|
401
|
+
# Clear npm cache
|
|
402
|
+
npm cache clean --force
|
|
403
|
+
|
|
404
|
+
# Reinstall latest version
|
|
405
|
+
npm install -g gbu-accessibility-package@latest
|
|
406
|
+
|
|
407
|
+
# Verify installation
|
|
408
|
+
gbu-a11y --version
|
|
409
|
+
gbu-a11y --help
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Local Project Management
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Remove from local project
|
|
416
|
+
npm uninstall gbu-accessibility-package
|
|
417
|
+
|
|
418
|
+
# Clear package-lock and node_modules
|
|
419
|
+
rm -rf node_modules package-lock.json
|
|
420
|
+
|
|
421
|
+
# Reinstall dependencies
|
|
422
|
+
npm install
|
|
423
|
+
|
|
424
|
+
# Add latest version
|
|
425
|
+
npm install gbu-accessibility-package@latest
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Clear Backup Files
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
# Remove all backup files in current directory
|
|
432
|
+
find . -name "*.backup" -type f -delete
|
|
433
|
+
|
|
434
|
+
# Remove backup files in specific directory
|
|
435
|
+
find ./src -name "*.backup" -type f -delete
|
|
436
|
+
|
|
437
|
+
# Using npm script (if configured)
|
|
438
|
+
npm run cleanup-backups
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Troubleshooting Installation
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
# Check npm configuration
|
|
445
|
+
npm config list
|
|
446
|
+
|
|
447
|
+
# Reset npm registry (if needed)
|
|
448
|
+
npm config set registry https://registry.npmjs.org/
|
|
449
|
+
|
|
450
|
+
# Check global packages
|
|
451
|
+
npm list -g --depth=0
|
|
452
|
+
|
|
453
|
+
# Fix permissions (macOS/Linux)
|
|
454
|
+
sudo chown -R $(whoami) ~/.npm
|
|
455
|
+
sudo chown -R $(whoami) /usr/local/lib/node_modules
|
|
456
|
+
|
|
457
|
+
# Alternative: Use npx without global install
|
|
458
|
+
npx gbu-accessibility-package --help
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Version Management
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
# Check current version
|
|
465
|
+
gbu-a11y --version
|
|
466
|
+
|
|
467
|
+
# Check available versions
|
|
468
|
+
npm view gbu-accessibility-package versions --json
|
|
469
|
+
|
|
470
|
+
# Install specific version
|
|
471
|
+
npm install -g gbu-accessibility-package@2.0.0
|
|
472
|
+
|
|
473
|
+
# Update to latest
|
|
474
|
+
npm update -g gbu-accessibility-package
|
|
475
|
+
```
|
|
476
|
+
|
|
331
477
|
## ๐ ๏ธ Configuration
|
|
332
478
|
|
|
333
479
|
### Package.json Scripts
|
|
334
|
-
|
|
335
480
|
```json
|
|
336
481
|
{
|
|
337
482
|
"scripts": {
|
|
338
483
|
"a11y:fix": "gbu-a11y",
|
|
339
484
|
"a11y:check": "gbu-a11y --dry-run",
|
|
340
485
|
"a11y:comprehensive": "gbu-a11y --comprehensive",
|
|
486
|
+
"a11y:forms": "gbu-a11y --forms-only",
|
|
487
|
+
"a11y:buttons": "gbu-a11y --buttons-only",
|
|
488
|
+
"a11y:links": "gbu-a11y --links-only",
|
|
489
|
+
"a11y:landmarks": "gbu-a11y --landmarks-only",
|
|
490
|
+
"a11y:headings": "gbu-a11y --headings-only",
|
|
341
491
|
"a11y:cleanup": "gbu-a11y --cleanup-only",
|
|
342
|
-
"
|
|
343
|
-
"a11y:lang": "gbu-a11y --lang-only",
|
|
344
|
-
"a11y:role": "gbu-a11y --role-only"
|
|
492
|
+
"cleanup-backups": "find . -name '*.backup' -type f -delete"
|
|
345
493
|
}
|
|
346
494
|
}
|
|
347
495
|
```
|
|
348
496
|
|
|
349
497
|
### CI/CD Integration
|
|
350
|
-
|
|
351
498
|
```yaml
|
|
352
499
|
# GitHub Actions example
|
|
353
500
|
- name: Check Accessibility
|
|
354
501
|
run: npx gbu-accessibility-package --dry-run
|
|
355
502
|
|
|
356
|
-
- name: Fix Accessibility Issues
|
|
503
|
+
- name: Fix Accessibility Issues
|
|
357
504
|
run: npx gbu-accessibility-package --comprehensive
|
|
358
505
|
```
|
|
359
506
|
|
|
507
|
+
## ๐ Accessibility Standards Coverage
|
|
508
|
+
|
|
509
|
+
This package addresses common issues found by axe DevTools:
|
|
510
|
+
|
|
511
|
+
### โ
Supported
|
|
512
|
+
- `image-alt` - Images must have alternate text
|
|
513
|
+
- `html-has-lang` - HTML element must have lang attribute
|
|
514
|
+
- `label` - Form elements must have labels (basic support)
|
|
515
|
+
- `button-name` - Buttons must have discernible text
|
|
516
|
+
- `link-name` - Links must have discernible text (basic support)
|
|
517
|
+
- `landmark-one-main` - Document should have one main landmark
|
|
518
|
+
- `region` - Page content should be contained by landmarks
|
|
519
|
+
- `heading-order` - Heading levels analysis (suggestions only)
|
|
520
|
+
- Duplicate role attributes cleanup
|
|
521
|
+
|
|
522
|
+
### ๐ Future Enhancements
|
|
523
|
+
- `color-contrast` - Color contrast checking
|
|
524
|
+
- `focus-order-semantics` - Focus order validation
|
|
525
|
+
- Advanced ARIA attributes validation
|
|
526
|
+
- Table accessibility features
|
|
527
|
+
- List structure validation
|
|
528
|
+
|
|
360
529
|
## ๐ค Contributing
|
|
361
530
|
|
|
362
531
|
1. Fork the repository
|
|
@@ -369,11 +538,113 @@ gbu-a11y --backup --comprehensive
|
|
|
369
538
|
|
|
370
539
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
371
540
|
|
|
541
|
+
## ๐ง Troubleshooting
|
|
542
|
+
|
|
543
|
+
### Common Issues and Solutions
|
|
544
|
+
|
|
545
|
+
#### Package Not Found or Command Not Working
|
|
546
|
+
```bash
|
|
547
|
+
# Check if package is installed globally
|
|
548
|
+
npm list -g gbu-accessibility-package
|
|
549
|
+
|
|
550
|
+
# If not found, install globally
|
|
551
|
+
npm install -g gbu-accessibility-package
|
|
552
|
+
|
|
553
|
+
# Check PATH includes npm global bin
|
|
554
|
+
echo $PATH | grep npm
|
|
555
|
+
|
|
556
|
+
# Add npm global bin to PATH (if needed)
|
|
557
|
+
export PATH=$PATH:$(npm config get prefix)/bin
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
#### Permission Errors
|
|
561
|
+
```bash
|
|
562
|
+
# macOS/Linux: Fix npm permissions
|
|
563
|
+
sudo chown -R $(whoami) ~/.npm
|
|
564
|
+
sudo chown -R $(whoami) $(npm config get prefix)
|
|
565
|
+
|
|
566
|
+
# Alternative: Use npx
|
|
567
|
+
npx gbu-accessibility-package --help
|
|
568
|
+
|
|
569
|
+
# Windows: Run as Administrator or use npx
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
#### Package Not Working After Update
|
|
573
|
+
```bash
|
|
574
|
+
# Complete reinstall
|
|
575
|
+
npm uninstall -g gbu-accessibility-package
|
|
576
|
+
npm cache clean --force
|
|
577
|
+
npm install -g gbu-accessibility-package@latest
|
|
578
|
+
|
|
579
|
+
# Verify installation
|
|
580
|
+
gbu-a11y --version
|
|
581
|
+
which gbu-a11y
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
#### Files Not Being Processed
|
|
585
|
+
```bash
|
|
586
|
+
# Check file extensions (only .html files supported)
|
|
587
|
+
ls -la *.html
|
|
588
|
+
|
|
589
|
+
# Check file permissions
|
|
590
|
+
ls -la your-file.html
|
|
591
|
+
|
|
592
|
+
# Run with verbose output
|
|
593
|
+
gbu-a11y --dry-run your-file.html
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
#### Backup Files Accumulating
|
|
597
|
+
```bash
|
|
598
|
+
# Clean all backup files
|
|
599
|
+
find . -name "*.backup" -type f -delete
|
|
600
|
+
|
|
601
|
+
# Prevent backup creation
|
|
602
|
+
gbu-a11y --no-backup
|
|
603
|
+
|
|
604
|
+
# Configure cleanup script
|
|
605
|
+
echo 'alias cleanup-backups="find . -name \"*.backup\" -type f -delete"' >> ~/.bashrc
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
#### Performance Issues
|
|
609
|
+
```bash
|
|
610
|
+
# Use --no-backup for faster processing
|
|
611
|
+
gbu-a11y --no-backup
|
|
612
|
+
|
|
613
|
+
# Process specific directories instead of entire project
|
|
614
|
+
gbu-a11y ./src
|
|
615
|
+
|
|
616
|
+
# Use individual modes for targeted fixes
|
|
617
|
+
gbu-a11y --alt-only ./images
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
#### Node.js Version Issues
|
|
621
|
+
```bash
|
|
622
|
+
# Check Node.js version (requires >=12.0.0)
|
|
623
|
+
node --version
|
|
624
|
+
|
|
625
|
+
# Update Node.js if needed
|
|
626
|
+
# Visit: https://nodejs.org/
|
|
627
|
+
|
|
628
|
+
# Use nvm to manage Node.js versions
|
|
629
|
+
nvm install 18
|
|
630
|
+
nvm use 18
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### Getting Help
|
|
634
|
+
|
|
635
|
+
If you're still experiencing issues:
|
|
636
|
+
|
|
637
|
+
1. **Check the version**: `gbu-a11y --version`
|
|
638
|
+
2. **Try dry run first**: `gbu-a11y --dry-run`
|
|
639
|
+
3. **Check file permissions**: `ls -la your-files.html`
|
|
640
|
+
4. **Clear cache and reinstall**: See package management section above
|
|
641
|
+
5. **Use npx as alternative**: `npx gbu-accessibility-package --help`
|
|
642
|
+
|
|
372
643
|
## ๐ Support
|
|
373
644
|
|
|
374
|
-
- ๐ง **Issues**: [GitHub Issues](https://github.com/
|
|
375
|
-
- ๐ **Documentation**: [GitHub Wiki](https://github.com/
|
|
376
|
-
- ๐ฌ **Discussions**: [GitHub Discussions](https://github.com/
|
|
645
|
+
- ๐ง **Issues**: [GitHub Issues](https://github.com/dangpv94/gbu-accessibility-tool/issues)
|
|
646
|
+
- ๐ **Documentation**: [GitHub Wiki](https://github.com/dangpv94/gbu-accessibility-tool/wiki)
|
|
647
|
+
- ๐ฌ **Discussions**: [GitHub Discussions](https://github.com/dangpv94/gbu-accessibility-tool/discussions)
|
|
377
648
|
|
|
378
649
|
## ๐ Why Choose GBU Accessibility Package?
|
|
379
650
|
|
|
@@ -383,7 +654,11 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
383
654
|
- โ
**Comprehensive** - Covers all major accessibility issues
|
|
384
655
|
- โ
**Fast & Efficient** - Batch processing with detailed reports
|
|
385
656
|
- โ
**WCAG Compliant** - Follows accessibility standards
|
|
657
|
+
- โ
**axe DevTools Compatible** - Fixes common axe issues
|
|
658
|
+
- โ
**Individual Control** - Fix specific issues or everything
|
|
659
|
+
- โ
**Safe Heading Analysis** - Suggests instead of auto-fixing
|
|
660
|
+
- โ
**Multi-language Support** - Japanese, English, and extensible
|
|
386
661
|
|
|
387
662
|
---
|
|
388
663
|
|
|
389
|
-
Made with โค๏ธ by the GBU Team
|
|
664
|
+
Made with โค๏ธ by the GBU Team
|