gbu-accessibility-package 3.12.1 โ 3.13.0
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 +9 -4
- package/QUICK_START.md +14 -157
- package/README-vi.md +104 -678
- package/README.md +105 -658
- package/bin/fix.js +1 -138
- package/cli.js +289 -578
- package/index.js +5 -2
- package/lib/checker.js +233 -0
- package/lib/fixer.js +109 -125
- package/package.json +13 -14
package/README.md
CHANGED
|
@@ -1,719 +1,166 @@
|
|
|
1
1
|
# GBU Accessibility Package
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessibility checking and reporting toolkit for HTML projects.
|
|
4
|
+
|
|
5
|
+
The package runs in check-only mode. It does not edit or delete source files, and is intended for accessibility review, project validation, and report export.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/gbu-accessibility-package)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
9
|
[](https://nodejs.org/)
|
|
8
10
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
### ๐ฏ **Core Accessibility Fixes**
|
|
12
|
-
- ๐ผ๏ธ **Smart Alt Text Generation** - Context-aware alt attributes for images
|
|
13
|
-
- ๐ท๏ธ **Aria Label Support** - Automatic aria-label matching alt text
|
|
14
|
-
- ๐ **HTML Lang Attributes** - Automatic language attribute fixes
|
|
15
|
-
- ๐ญ **Role Attributes** - WCAG-compliant role attribute management
|
|
16
|
-
- ๐ท๏ธ **Aria Labels** - Automatic aria-label generation from alt text and content
|
|
17
|
-
- ๐ **Form Labels** - Fix missing labels with intelligent aria-label generation
|
|
18
|
-
- ๐ **Button Names** - Fix empty buttons and input buttons without names
|
|
19
|
-
- ๐ **Link Names** - Fix empty links and detect generic link text
|
|
20
|
-
- ๐๏ธ **Landmarks** - Add missing main and navigation landmarks
|
|
21
|
-
- ๐ **Heading Analysis & Auto-Fix** - Analyze heading structure with optional auto-fix using `--auto-fix-headings`
|
|
22
|
-
- ๐ฏ **Nested Controls Detection** - Detect and fix nested interactive controls
|
|
23
|
-
- ๐ **Broken Links Detection** - Detect broken external links
|
|
24
|
-
- ๐ **404 Resources Detection** - Detect missing local resources (images, CSS, JS, etc.)
|
|
25
|
-
- ๐ท๏ธ **Google Tag Manager Check** - Validate GTM installation (script + noscript)
|
|
26
|
-
- ๐ท๏ธ **Meta Tags Validation** - Check for typos and syntax errors in meta tags and Open Graph Protocol
|
|
27
|
-
- โ๏ธ **Meta Tags Auto-Fix** - Automatically fix typos in meta property names and content values
|
|
28
|
-
- ๐๏ธ **Unused Files Detection** - Find files not referenced anywhere in the project
|
|
29
|
-
- โ ๏ธ **Dead Code Analysis** - Detect unused CSS rules and JavaScript functions
|
|
30
|
-
- ๐ **File Size Analysis** - Check file sizes and suggest optimizations
|
|
31
|
-
- ๐งน **Duplicate Cleanup** - Remove duplicate role attributes
|
|
32
|
-
|
|
33
|
-
### ๐ **Enhanced Alt Attribute Features (Integrated!)**
|
|
34
|
-
- ๐ **Comprehensive Analysis** - Image type classification and quality checking built-in
|
|
35
|
-
- ๐จ **Diverse Alt Generation** - Multiple strategies for creative alt text integrated in core
|
|
36
|
-
- ๐ **Multi-language Support** - Japanese, English, Vietnamese vocabulary built-in
|
|
37
|
-
- ๐ญ **Creativity Levels** - Conservative, Balanced, Creative modes
|
|
38
|
-
- ๐ง **Context Awareness** - Brand, emotional, and technical context integration
|
|
39
|
-
- ๐ **Data Visualization** - Specialized descriptions for charts and graphs
|
|
40
|
-
- ๐งน **Clean Architecture** - All enhanced features integrated in a single file
|
|
41
|
-
|
|
42
|
-
### ๐ ๏ธ **Utility Features**
|
|
43
|
-
- ๐ **Batch Processing** - Process entire directories recursively
|
|
44
|
-
- ๐พ **Optional Backups** - Create backup files when needed with --backup flag
|
|
45
|
-
- ๐ **Dry Run Mode** - Preview changes before applying
|
|
46
|
-
- ๐ **Detailed Reports** - Comprehensive fix summaries
|
|
47
|
-
- โก **Individual Fix Modes** - Target specific accessibility issues
|
|
48
|
-
|
|
49
|
-
## ๐ Quick Start
|
|
50
|
-
|
|
51
|
-
### Installation
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
# Global installation (recommended)
|
|
55
|
-
npm install -g gbu-accessibility-package
|
|
11
|
+
## What It Does
|
|
56
12
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
13
|
+
- Checks HTML `lang`, `alt`, `role`, `aria-label`, forms, buttons, links, landmarks, nested controls, headings, and description lists
|
|
14
|
+
- Checks broken external links and missing local resources
|
|
15
|
+
- Checks meta tags, Google Tag Manager installation, dead code, unused files, and large files
|
|
16
|
+
- Exports unused file lists and comprehensive Excel reports
|
|
17
|
+
- Supports enhanced alt-text analysis with stricter review rules and richer suggestions
|
|
60
18
|
|
|
61
|
-
|
|
19
|
+
## Installation
|
|
62
20
|
|
|
63
21
|
```bash
|
|
64
|
-
|
|
65
|
-
npm uninstall -g gbu-accessibility-package
|
|
66
|
-
|
|
67
|
-
# Uninstall local package
|
|
68
|
-
npm uninstall gbu-accessibility-package
|
|
69
|
-
|
|
70
|
-
# Clear npm cache (recommended when having issues)
|
|
71
|
-
npm cache clean --force
|
|
72
|
-
|
|
73
|
-
# Reinstall latest version
|
|
74
|
-
npm install -g gbu-accessibility-package@latest
|
|
75
|
-
|
|
76
|
-
# Check installed version
|
|
77
|
-
npm list -g gbu-accessibility-package
|
|
78
|
-
gbu-a11y --version
|
|
79
|
-
|
|
80
|
-
# Install specific version
|
|
81
|
-
npm install -g gbu-accessibility-package@3.2.1
|
|
22
|
+
npm install -g gbu-accessibility-package
|
|
82
23
|
```
|
|
83
24
|
|
|
84
|
-
|
|
25
|
+
Or install locally:
|
|
85
26
|
|
|
86
27
|
```bash
|
|
87
|
-
|
|
88
|
-
sudo npm install -g gbu-accessibility-package
|
|
89
|
-
|
|
90
|
-
# If cache issues
|
|
91
|
-
npm cache clean --force
|
|
92
|
-
npm install -g gbu-accessibility-package --force
|
|
93
|
-
|
|
94
|
-
# Verify installation
|
|
95
|
-
which gbu-a11y
|
|
96
|
-
gbu-a11y --help
|
|
97
|
-
|
|
98
|
-
# Update to latest version
|
|
99
|
-
npm update -g gbu-accessibility-package
|
|
28
|
+
npm install gbu-accessibility-package
|
|
100
29
|
```
|
|
101
30
|
|
|
102
|
-
|
|
31
|
+
## Quick Start
|
|
103
32
|
|
|
104
33
|
```bash
|
|
105
|
-
#
|
|
34
|
+
# Default comprehensive check
|
|
106
35
|
gbu-a11y
|
|
107
36
|
|
|
108
|
-
#
|
|
109
|
-
gbu-a11y --dry-run
|
|
110
|
-
|
|
111
|
-
# Fix specific directory
|
|
37
|
+
# Check a specific directory
|
|
112
38
|
gbu-a11y ./src
|
|
113
39
|
|
|
114
|
-
#
|
|
115
|
-
gbu-a11y
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Enhanced Alt Attribute Mode
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# Enable enhanced alt attribute analysis
|
|
122
|
-
gbu-a11y --enhanced-alt
|
|
123
|
-
|
|
124
|
-
# Creative alt text generation with emotions
|
|
125
|
-
gbu-a11y --enhanced-alt --alt-creativity creative --include-emotions
|
|
40
|
+
# Check only alt text issues
|
|
41
|
+
gbu-a11y --alt-only ./src
|
|
126
42
|
|
|
127
|
-
#
|
|
128
|
-
gbu-a11y --
|
|
43
|
+
# Check broken links and missing resources
|
|
44
|
+
gbu-a11y --links-check ./public
|
|
129
45
|
|
|
130
|
-
#
|
|
131
|
-
gbu-a11y -
|
|
46
|
+
# Export a full Excel report
|
|
47
|
+
gbu-a11y --full-report -o reports/accessibility-report.xlsx
|
|
132
48
|
```
|
|
133
49
|
|
|
134
|
-
##
|
|
135
|
-
|
|
136
|
-
### Command Line Options
|
|
50
|
+
## CLI
|
|
137
51
|
|
|
138
52
|
```bash
|
|
139
|
-
gbu-a11y [options] [directory
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Examples
|
|
53
|
+
gbu-a11y [options] [directory]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Core options:
|
|
57
|
+
|
|
58
|
+
- `-d, --directory <path>`: target directory, defaults to current directory
|
|
59
|
+
- `-l, --language <lang>`: language context, defaults to `ja`
|
|
60
|
+
- `--dry-run`: legacy alias; check-only mode is always on
|
|
61
|
+
- `-h, --help`: show help
|
|
62
|
+
- `-v, --version`: show version
|
|
63
|
+
|
|
64
|
+
Check modes:
|
|
65
|
+
|
|
66
|
+
- `--comprehensive`, `--all`: run the default multi-area review for accessibility structure, labels, links/resources, and project-level quality signals in one pass
|
|
67
|
+
- `--alt-only`: review image alt text quality, including missing `alt`, empty `alt` on meaningful images, overly generic descriptions, and enhanced alt analysis when enabled
|
|
68
|
+
- `--lang-only`: review missing or incorrect root HTML `lang` usage so you can catch pages that do not declare the expected document language
|
|
69
|
+
- `--role-only`: review suspicious or missing ARIA role usage, including cases where elements may need better semantic roles or have role patterns that do not match their behavior
|
|
70
|
+
- `--aria-label-only`: review elements that depend on `aria-label` for accessible naming, such as images, links, or controls that do not expose enough text on their own
|
|
71
|
+
- `--forms-only`: review form accessibility issues such as inputs without clear labels, weak accessible names, or fields that rely too heavily on placeholder text
|
|
72
|
+
- `--nested-only`: review nested interactive controls, for example a `button` inside a link, a link inside a button, or clickable controls placed inside other focusable widgets; these patterns often confuse keyboard users and screen readers because multiple interactive targets overlap
|
|
73
|
+
- `--buttons-only`: review buttons and button-like controls for missing accessible names, empty text, or controls that appear clickable but do not expose enough meaning
|
|
74
|
+
- `--links-only`: review accessible link naming issues such as empty links, image-only links without usable text alternatives, or vague labels like โclick hereโ without context
|
|
75
|
+
- `--landmarks-only`: review page landmark structure such as missing `main`, weak navigation structure, or layouts that make region-based navigation harder for assistive technology users
|
|
76
|
+
- `--headings-only`: review heading hierarchy and document outline problems, such as skipped heading levels, duplicate headings in the same context, multiple top-level headings, or empty heading text
|
|
77
|
+
- `--dl-only`: review description list markup problems, such as invalid `dl` structure, missing `dt`/`dd` pairing, or malformed content inside description lists
|
|
78
|
+
- `--links-check`: run both external link validation and local resource existence checks so you can catch broken URLs and missing files together
|
|
79
|
+
- `--broken-links`: check external HTTP/HTTPS links only and report unreachable URLs, 404/5xx responses, redirects that fail, and similar outbound link problems
|
|
80
|
+
- `--404-resources`: check local resources only, such as missing images, scripts, stylesheets, and other referenced files that do not exist at the expected path
|
|
81
|
+
- `--gtm-check`: review Google Tag Manager installation patterns, including whether the expected script and `noscript` pieces are present and placed correctly
|
|
82
|
+
- `--check-meta`: review meta tags and Open Graph metadata for typos, malformed attributes, suspicious property names, and other metadata quality issues
|
|
83
|
+
- `--unused-files`: scan the project for files that do not appear to be referenced anywhere, helping you spot dead assets or stale source files for manual review
|
|
84
|
+
- `--unused-files-list`: export the unused-file findings to a text file so your team can review and clean them up manually outside the tool
|
|
85
|
+
- `--dead-code`: review CSS and JavaScript for selectors, rules, or functions that appear unused based on static project references
|
|
86
|
+
- `--file-size`: review large files and oversized assets to highlight optimization opportunities and possible frontend performance risks
|
|
87
|
+
- `--full-report`: generate the Excel report with aggregated findings across the supported check areas for sharing, triage, or audit tracking
|
|
88
|
+
- `-o, --output <file>`: custom output path for `--full-report`
|
|
89
|
+
- `--list-file <file>`: custom output path/name for `--unused-files-list`
|
|
90
|
+
|
|
91
|
+
Enhanced alt analysis:
|
|
92
|
+
|
|
93
|
+
- `--enhanced-alt`
|
|
94
|
+
- `--alt-creativity <mode>`: `conservative`, `balanced`, `creative`
|
|
95
|
+
- `--include-emotions`
|
|
96
|
+
- `--strict-alt`
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
188
99
|
|
|
189
100
|
```bash
|
|
190
|
-
#
|
|
101
|
+
# Comprehensive review
|
|
191
102
|
gbu-a11y
|
|
192
103
|
|
|
193
|
-
#
|
|
194
|
-
gbu-a11y --
|
|
195
|
-
|
|
196
|
-
# Fix with English language
|
|
197
|
-
gbu-a11y -l en ./public
|
|
198
|
-
|
|
199
|
-
# Individual fix types
|
|
200
|
-
gbu-a11y --alt-only # Fix alt attributes + cleanup
|
|
201
|
-
gbu-a11y --aria-label-only # Fix aria-label attributes + cleanup
|
|
202
|
-
gbu-a11y --forms-only # Fix form labels + cleanup
|
|
203
|
-
gbu-a11y --buttons-only # Fix button names + cleanup
|
|
204
|
-
gbu-a11y --headings-only # Analyze heading structure
|
|
205
|
-
gbu-a11y --headings-only --auto-fix-headings # Auto-fix heading structure
|
|
206
|
-
gbu-a11y --links-check # Check broken links and missing resources + cleanup
|
|
207
|
-
gbu-a11y --broken-links # Check broken external links only + cleanup
|
|
208
|
-
gbu-a11y --404-resources # Check missing local resources only + cleanup
|
|
209
|
-
gbu-a11y --gtm-check # Check Google Tag Manager installation
|
|
210
|
-
gbu-a11y --check-meta # Check meta tags for typos and syntax errors
|
|
211
|
-
gbu-a11y --fix-meta # Auto-fix meta tag typos
|
|
212
|
-
gbu-a11y --fix-meta --dry-run # Preview meta tag fixes
|
|
213
|
-
gbu-a11y --full-report # Generate comprehensive Excel report
|
|
214
|
-
gbu-a11y --full-report -o report.xlsx # Custom output path
|
|
215
|
-
gbu-a11y --unused-files # Check for unused files in project
|
|
216
|
-
gbu-a11y --unused-files-list # Create ./unused-files-list.txt
|
|
217
|
-
gbu-a11y --delete-unused-files # Delete files listed in ./unused-files-list.txt
|
|
218
|
-
gbu-a11y --delete-unused-files --dry-run # Preview files that would be deleted
|
|
219
|
-
gbu-a11y --dead-code # Check for dead CSS and JavaScript code
|
|
220
|
-
gbu-a11y --file-size # Check file sizes and suggest optimizations
|
|
221
|
-
|
|
222
|
-
# Enhanced alt attribute features
|
|
223
|
-
gbu-a11y --enhanced-alt # Basic enhanced mode
|
|
224
|
-
gbu-a11y --enhanced-alt --alt-creativity creative # Creative descriptions
|
|
225
|
-
gbu-a11y --enhanced-alt --include-emotions # Include emotional context
|
|
226
|
-
gbu-a11y --enhanced-alt --strict-alt # Strict quality checking
|
|
227
|
-
gbu-a11y -l en --enhanced-alt --alt-creativity creative # English creative mode
|
|
228
|
-
|
|
229
|
-
# Combine with other options
|
|
230
|
-
gbu-a11y --enhanced-alt --backup ./src # Enhanced mode with backups
|
|
231
|
-
gbu-a11y --enhanced-alt --dry-run # Preview enhanced fixes
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## ๐จ Enhanced Alt Attribute Features
|
|
235
|
-
|
|
236
|
-
### Creativity Levels
|
|
237
|
-
|
|
238
|
-
#### Conservative
|
|
239
|
-
- Simple, factual descriptions
|
|
240
|
-
- Focus on basic functionality
|
|
241
|
-
- Minimal vocabulary variation
|
|
242
|
-
|
|
243
|
-
**Example**: `alt="Chart"`, `alt="Logo"`
|
|
244
|
-
|
|
245
|
-
#### Balanced (Default)
|
|
246
|
-
- Context-aware descriptions
|
|
247
|
-
- Moderate creativity
|
|
248
|
-
- Balance between simple and detailed
|
|
249
|
-
|
|
250
|
-
**Example**: `alt="Sales performance chart"`, `alt="Company logo"`
|
|
104
|
+
# Forms only
|
|
105
|
+
gbu-a11y --forms-only ./pages
|
|
251
106
|
|
|
252
|
-
|
|
253
|
-
-
|
|
254
|
-
- Emotional context integration
|
|
255
|
-
- High brand and context awareness
|
|
107
|
+
# Broken links only
|
|
108
|
+
gbu-a11y --broken-links ./dist
|
|
256
109
|
|
|
257
|
-
|
|
110
|
+
# Meta tags only
|
|
111
|
+
gbu-a11y --check-meta ./site
|
|
258
112
|
|
|
259
|
-
|
|
113
|
+
# Unused file list export
|
|
114
|
+
gbu-a11y --unused-files-list --list-file reports/unused-files.txt ./project
|
|
260
115
|
|
|
261
|
-
|
|
262
|
-
-
|
|
263
|
-
- **Data Visualizations**: Include chart type, trends, and key data points
|
|
264
|
-
- **Complex Images**: Short alt + recommendation for detailed description
|
|
265
|
-
- **Logos**: Include brand name and "logo" keyword
|
|
266
|
-
- **Content Images**: Context-aware descriptions based on surrounding content
|
|
267
|
-
|
|
268
|
-
### Quality Checks
|
|
269
|
-
|
|
270
|
-
- โ **Error Level**: Missing alt, empty alt for content, generic text
|
|
271
|
-
- โ ๏ธ **Warning Level**: Too long/short, redundant words, filename in alt
|
|
272
|
-
- โน๏ธ **Info Level**: Optimization suggestions, consistency checks
|
|
273
|
-
|
|
274
|
-
## ๐ Programmatic Usage
|
|
275
|
-
|
|
276
|
-
### Basic Usage
|
|
277
|
-
|
|
278
|
-
```javascript
|
|
279
|
-
const { AccessibilityFixer } = require('gbu-accessibility-package');
|
|
280
|
-
|
|
281
|
-
const fixer = new AccessibilityFixer({
|
|
282
|
-
language: 'ja',
|
|
283
|
-
backupFiles: true,
|
|
284
|
-
dryRun: false
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
// Fix all accessibility issues
|
|
288
|
-
fixer.fixAllAccessibilityIssues('./src').then(results => {
|
|
289
|
-
console.log('Accessibility fixes completed:', results);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
// Fix specific issues
|
|
293
|
-
await fixer.fixEmptyAltAttributes('./src');
|
|
294
|
-
await fixer.fixFormLabels('./src');
|
|
295
|
-
await fixer.fixButtonNames('./src');
|
|
116
|
+
# Enhanced alt review
|
|
117
|
+
gbu-a11y --alt-only --enhanced-alt --strict-alt ./src
|
|
296
118
|
```
|
|
297
119
|
|
|
298
|
-
|
|
120
|
+
## Programmatic Usage
|
|
299
121
|
|
|
300
|
-
```
|
|
301
|
-
const {
|
|
122
|
+
```js
|
|
123
|
+
const { AccessibilityChecker } = require('gbu-accessibility-package');
|
|
302
124
|
|
|
303
|
-
|
|
304
|
-
const fixer = new AccessibilityFixer({
|
|
125
|
+
const checker = new AccessibilityChecker({
|
|
305
126
|
language: 'en',
|
|
306
127
|
enhancedAltMode: true,
|
|
307
|
-
altCreativity: 'creative',
|
|
308
|
-
includeEmotions: true,
|
|
309
128
|
strictAltChecking: true
|
|
310
129
|
});
|
|
311
130
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
console.log('Accessibility fixes completed with enhanced features:', results);
|
|
318
|
-
|
|
319
|
-
// New: Check for unused files
|
|
320
|
-
await fixer.checkUnusedFiles('./src');
|
|
131
|
+
async function main() {
|
|
132
|
+
await checker.checkAltText('./src');
|
|
133
|
+
await checker.checkBrokenLinks('./src');
|
|
134
|
+
await checker.generateFullReport('./src', './reports/accessibility-report.xlsx');
|
|
135
|
+
}
|
|
321
136
|
|
|
322
|
-
|
|
323
|
-
await fixer.checkDeadCode('./src');
|
|
324
|
-
|
|
325
|
-
// New: Check file sizes
|
|
326
|
-
await fixer.checkFileSizes('./src');
|
|
137
|
+
main().catch(console.error);
|
|
327
138
|
```
|
|
328
139
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
### Alt Attributes (Enhanced Mode)
|
|
332
|
-
- **Missing alt attributes** โ Context-aware alt text generation
|
|
333
|
-
- **Empty alt attributes** โ Smart content-based descriptions
|
|
334
|
-
- **Generic alt text** โ Specific, meaningful descriptions
|
|
335
|
-
- **Too long alt text** โ Optimized length with key information
|
|
336
|
-
- **Redundant words** โ Clean, concise descriptions
|
|
337
|
-
- **Data visualizations** โ Chart type + trends + key data
|
|
338
|
-
|
|
339
|
-
### Form Accessibility
|
|
340
|
-
- **Missing form labels** โ Intelligent aria-label generation
|
|
341
|
-
- **Unlabeled inputs** โ Context-based label suggestions
|
|
342
|
-
- **Form structure** โ Proper label associations
|
|
343
|
-
|
|
344
|
-
### Interactive Elements
|
|
345
|
-
- **Empty buttons** โ Action-based button names
|
|
346
|
-
- **Generic link text** โ Descriptive link purposes
|
|
347
|
-
- **Missing button names** โ Function-based descriptions
|
|
348
|
-
|
|
349
|
-
### Document Structure
|
|
350
|
-
- **Missing lang attributes** โ Automatic language detection
|
|
351
|
-
- **Missing landmarks** โ Main and navigation landmarks
|
|
352
|
-
- **Heading structure** โ Analysis and auto-fix with `--auto-fix-headings`
|
|
353
|
-
- Fix multiple h1 elements
|
|
354
|
-
- Fix heading level skipping (h2 โ h4)
|
|
355
|
-
- Add text to empty headings
|
|
356
|
-
- Fix duplicate headings
|
|
357
|
-
- **Nested interactive controls** โ Detect and fix nested controls
|
|
358
|
-
- **Role attributes** โ WCAG-compliant role assignments
|
|
359
|
-
|
|
360
|
-
### Link Validation
|
|
361
|
-
- **Broken External Links** โ Detect HTTP 404, 500, timeout errors on external URLs
|
|
362
|
-
- Invalid URLs โ Detect malformed URL formats
|
|
363
|
-
- Slow links โ Warn about timeouts and slow responses
|
|
364
|
-
- Network errors โ Connection failures and unreachable hosts
|
|
365
|
-
- **404 Missing Resources** โ Check for missing local files
|
|
366
|
-
- Images (img src), CSS files (link href), JavaScript files (script src)
|
|
367
|
-
- Video/audio sources, other local assets
|
|
368
|
-
- Relative and absolute path checking
|
|
369
|
-
|
|
370
|
-
### Project Optimization
|
|
371
|
-
- **Unused Files** โ Detect files not referenced anywhere in the project
|
|
372
|
-
- Images, CSS, SCSS/Sass, JavaScript, JSX, TypeScript, Vue, PHP, JSON, Markdown, XML, PDF, Video, Audio files
|
|
373
|
-
- Local file references analysis
|
|
374
|
-
- Heuristic detection with manual review recommendations
|
|
375
|
-
- **Dead Code Analysis** โ Find unused CSS rules and JavaScript functions
|
|
376
|
-
- CSS selectors not used in HTML
|
|
377
|
-
- JavaScript functions never called
|
|
378
|
-
- Variables declared but never used
|
|
379
|
-
- Smart skipping of dynamic patterns
|
|
380
|
-
- **Google Tag Manager Check** โ Validate GTM installation
|
|
381
|
-
- Detect GTM script in `<head>` section
|
|
382
|
-
- Verify noscript fallback in `<body>` section
|
|
383
|
-
- Check container ID consistency
|
|
384
|
-
- Validate proper positioning of both snippets
|
|
385
|
-
- Reports: complete installation, missing components, position issues
|
|
386
|
-
- **Meta Tags Validation** โ Check typos and syntax errors in meta tags
|
|
387
|
-
- Detect property name typos (og:titel โ og:title, discription โ description)
|
|
388
|
-
- Detect content value typos (websit โ website, ja_jp โ ja_JP)
|
|
389
|
-
- Check syntax errors (missing content, empty values)
|
|
390
|
-
- Support Open Graph Protocol and Twitter Card
|
|
391
|
-
- 40+ common typo patterns in dictionary
|
|
392
|
-
- **Meta Tags Auto-Fix** โ Automatically fix meta tag errors
|
|
393
|
-
- Fix property name typos in one click
|
|
394
|
-
- Fix content value typos
|
|
395
|
-
- Handle multiple errors on same tag
|
|
396
|
-
- Dry-run mode for preview
|
|
397
|
-
- Backup support for safety
|
|
398
|
-
- **File Size Analysis** โ Check file sizes and suggest optimizations
|
|
399
|
-
- Detect large files exceeding recommended thresholds
|
|
400
|
-
- Type-specific optimization suggestions (images, CSS, JS, etc.)
|
|
401
|
-
- File size breakdown by type
|
|
402
|
-
- Top 10 largest files reporting
|
|
403
|
-
|
|
404
|
-
## ๐ท๏ธ Google Tag Manager Validation
|
|
405
|
-
|
|
406
|
-
The `--gtm-check` feature validates proper Google Tag Manager installation across your project.
|
|
407
|
-
|
|
408
|
-
### What It Checks
|
|
409
|
-
|
|
410
|
-
1. **Script in `<head>`**: Verifies GTM script is present before `</head>` closing tag
|
|
411
|
-
2. **Noscript in `<body>`**: Confirms noscript fallback is immediately after `<body>` opening tag
|
|
412
|
-
3. **Container ID**: Ensures both snippets use the same GTM container ID (format: GTM-XXXXXX)
|
|
413
|
-
4. **Position Validation**: Checks optimal placement of both code snippets
|
|
414
|
-
|
|
415
|
-
### Usage
|
|
140
|
+
`AccessibilityFixer` is still exported for compatibility, but it is now locked to the same check-only behavior and will not modify source files.
|
|
416
141
|
|
|
417
|
-
|
|
418
|
-
# Check GTM installation in entire project
|
|
419
|
-
gbu-a11y --gtm-check
|
|
142
|
+
## Output Behavior
|
|
420
143
|
|
|
421
|
-
|
|
422
|
-
|
|
144
|
+
- Source files stay unchanged
|
|
145
|
+
- `--unused-files-list` writes a report file only
|
|
146
|
+
- `--full-report` writes an Excel report only
|
|
147
|
+
- Findings are printed to the console during analysis
|
|
423
148
|
|
|
424
|
-
|
|
425
|
-
gbu-a11y --check-gtm
|
|
426
|
-
gbu-a11y --google-tag-manager
|
|
427
|
-
```
|
|
149
|
+
## Publish Checklist
|
|
428
150
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
```
|
|
432
|
-
๐ท๏ธ ฤang kiแปm tra cร i ฤแบทt Google Tag Manager (GTM)...
|
|
433
|
-
|
|
434
|
-
๐ public/index.html:
|
|
435
|
-
โ
GTM Container ID: GTM-ABC1234
|
|
436
|
-
โ
Script trong head: ฤรฃ ฤแบทt ฤรบng vแป trรญ trฦฐแปc </head>
|
|
437
|
-
โ
Noscript trong body: ฤรฃ ฤแบทt ฤรบng vแป trรญ sau <body>
|
|
438
|
-
|
|
439
|
-
๐ public/about.html:
|
|
440
|
-
โ
GTM Container ID: GTM-ABC1234
|
|
441
|
-
โ
Script trong head: ฤรฃ ฤแบทt ฤรบng vแป trรญ trฦฐแปc </head>
|
|
442
|
-
โ Noscript trong body: Thiแบฟu sau thแบป <body>
|
|
443
|
-
โ Thiแบฟu GTM Noscript: Tรฌm thแบฅy GTM script nhฦฐng thiแบฟu noscript dแปฑ phรฒng trong <body>
|
|
444
|
-
๐ก Thรชm ฤoแบกn mรฃ GTM noscript ngay sau thแบป mแป <body>
|
|
445
|
-
|
|
446
|
-
๐ Tรณm tแบฏt: ฤรฃ phรขn tรญch 2 file
|
|
447
|
-
โ
File cรณ GTM: 2
|
|
448
|
-
โ ๏ธ File cรณ vแบฅn ฤแป vแป GTM: 1
|
|
449
|
-
๐ก GTM cแบงn cรณ cแบฃ <script> trong <head> vร <noscript> sau <body>
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
### GTM Installation Requirements
|
|
453
|
-
|
|
454
|
-
For proper GTM installation, each page should have:
|
|
455
|
-
|
|
456
|
-
1. **Script snippet in `<head>`**:
|
|
457
|
-
```html
|
|
458
|
-
<head>
|
|
459
|
-
<!-- Google Tag Manager -->
|
|
460
|
-
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
461
|
-
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
462
|
-
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
463
|
-
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
464
|
-
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
|
|
465
|
-
<!-- End Google Tag Manager -->
|
|
466
|
-
</head>
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
2. **Noscript snippet immediately after `<body>`**:
|
|
470
|
-
```html
|
|
471
|
-
<body>
|
|
472
|
-
<!-- Google Tag Manager (noscript) -->
|
|
473
|
-
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
|
|
474
|
-
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|
475
|
-
<!-- End Google Tag Manager (noscript) -->
|
|
476
|
-
|
|
477
|
-
<!-- Your page content -->
|
|
478
|
-
</body>
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
## ๐ท๏ธ Meta Tags Validation & Auto-Fix
|
|
482
|
-
|
|
483
|
-
The `--check-meta` and `--fix-meta` features help you maintain correct meta tags and Open Graph Protocol implementation.
|
|
484
|
-
|
|
485
|
-
### What It Checks
|
|
486
|
-
|
|
487
|
-
1. **Property Name Typos**: Detects common misspellings in meta tag properties
|
|
488
|
-
- `og:titel` โ `og:title`
|
|
489
|
-
- `og:descripion` โ `og:description`
|
|
490
|
-
- `og:sitename` โ `og:site_name`
|
|
491
|
-
- `discription` โ `description`
|
|
492
|
-
- And 40+ more common typos
|
|
493
|
-
|
|
494
|
-
2. **Content Value Typos**: Fixes incorrect values
|
|
495
|
-
- `websit` โ `website` (og:type)
|
|
496
|
-
- `ja_jp` โ `ja_JP` (og:locale)
|
|
497
|
-
- `summary_larg_image` โ `summary_large_image` (twitter:card)
|
|
498
|
-
|
|
499
|
-
3. **Syntax Errors**: Identifies structural issues
|
|
500
|
-
- Missing content attributes
|
|
501
|
-
- Empty content values
|
|
502
|
-
- Mixed quote styles
|
|
503
|
-
|
|
504
|
-
### Usage
|
|
151
|
+
Before publishing:
|
|
505
152
|
|
|
506
153
|
```bash
|
|
507
|
-
# Check for meta tag errors
|
|
508
|
-
gbu-a11y --check-meta
|
|
509
|
-
|
|
510
|
-
# Check specific directory
|
|
511
|
-
gbu-a11y --check-meta ./public
|
|
512
|
-
|
|
513
|
-
# Auto-fix errors
|
|
514
|
-
gbu-a11y --fix-meta
|
|
515
|
-
|
|
516
|
-
# Preview fixes without applying
|
|
517
|
-
gbu-a11y --fix-meta --dry-run
|
|
518
|
-
|
|
519
|
-
# Fix with backup
|
|
520
|
-
gbu-a11y --fix-meta --backup
|
|
521
|
-
|
|
522
|
-
# Alternative commands
|
|
523
|
-
gbu-a11y --meta-check
|
|
524
|
-
gbu-a11y --meta-fix
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
### Example Output
|
|
528
|
-
|
|
529
|
-
**Check Mode (`--check-meta`)**:
|
|
530
|
-
```
|
|
531
|
-
๐ Checking meta tags for typos and syntax errors...
|
|
532
|
-
|
|
533
|
-
โ public/index.html
|
|
534
|
-
1. Lแปi chรญnh tแบฃ property: "og:titel" โ "og:title"
|
|
535
|
-
2. Lแปi chรญnh tแบฃ property: "og:descripion" โ "og:description"
|
|
536
|
-
3. Lแปi giรก trแป og:type: "websit" โ "website"
|
|
537
|
-
4. Lแปi chรญnh tแบฃ property: "twitter:car" โ "twitter:card"
|
|
538
|
-
|
|
539
|
-
โ
public/about.html - No errors
|
|
540
|
-
|
|
541
|
-
๐ Summary:
|
|
542
|
-
Total files checked: 2
|
|
543
|
-
Files with errors: 1
|
|
544
|
-
Total errors found: 4
|
|
545
|
-
Files OK: 1
|
|
546
|
-
|
|
547
|
-
๐ก Sแปญ dแปฅng --meta-fix ฤแป tแปฑ ฤแปng sแปญa cรกc lแปi nร y
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
**Fix Mode (`--fix-meta`)**:
|
|
551
|
-
```
|
|
552
|
-
๐ง Fixing meta tag typos and syntax errors...
|
|
553
|
-
|
|
554
|
-
๐ง Fixing: public/index.html
|
|
555
|
-
โ Fixed property: og:titel โ og:title
|
|
556
|
-
โ Fixed property: og:descripion โ og:description
|
|
557
|
-
โ Fixed og:type value: websit โ website
|
|
558
|
-
โ Fixed property: twitter:car โ twitter:card
|
|
559
|
-
๐พ Saved 4 fix(es) to public/index.html
|
|
560
|
-
|
|
561
|
-
โ
public/about.html - No errors to fix
|
|
562
|
-
|
|
563
|
-
๐ Summary:
|
|
564
|
-
Total files checked: 2
|
|
565
|
-
Files fixed: 1
|
|
566
|
-
Total fixes applied: 4
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
### Supported Typo Patterns
|
|
570
|
-
|
|
571
|
-
**Open Graph Properties**:
|
|
572
|
-
- `og:titel`, `og:tittle`, `og:tilte` โ `og:title`
|
|
573
|
-
- `og:descripion`, `og:discription`, `og:desciption` โ `og:description`
|
|
574
|
-
- `og:imge`, `og:iamge` โ `og:image`
|
|
575
|
-
- `og:typ`, `og:tipe` โ `og:type`
|
|
576
|
-
- `og:sitename`, `og:sit_name` โ `og:site_name`
|
|
577
|
-
- `og:local` โ `og:locale`
|
|
578
|
-
|
|
579
|
-
**Twitter Card Properties**:
|
|
580
|
-
- `twitter:car` โ `twitter:card`
|
|
581
|
-
- `twitter:titel`, `twitter:tittle` โ `twitter:title`
|
|
582
|
-
- `twitter:descripion`, `twitter:discription` โ `twitter:description`
|
|
583
|
-
- `twitter:imge` โ `twitter:image`
|
|
584
|
-
- `twitter:creater` โ `twitter:creator`
|
|
585
|
-
|
|
586
|
-
**Meta Tag Properties**:
|
|
587
|
-
- `discription`, `descripion`, `desciption` โ `description`
|
|
588
|
-
- `viewpor`, `veiwport` โ `viewport`
|
|
589
|
-
- `keyword` โ `keywords`
|
|
590
|
-
- `auther`, `autor` โ `author`
|
|
591
|
-
|
|
592
|
-
**Content Values**:
|
|
593
|
-
- `websit`, `web-site`, `artical`, `aticle` (og:type)
|
|
594
|
-
- `ja_jp` โ `ja_JP`, `en_us` โ `en_US`, `vi_vn` โ `vi_VN` (og:locale)
|
|
595
|
-
- `summary_larg_image`, `summay` (twitter:card)
|
|
596
|
-
|
|
597
|
-
<!-- Your page content -->
|
|
598
|
-
</body>
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
### Common Issues Detected
|
|
602
|
-
|
|
603
|
-
- โ **Missing Script**: GTM script not found in `<head>`
|
|
604
|
-
- โ **Missing Noscript**: Noscript fallback not found after `<body>`
|
|
605
|
-
- โ ๏ธ **Wrong Position**: Script or noscript not in optimal position
|
|
606
|
-
- โ **ID Mismatch**: Different container IDs between script and noscript
|
|
607
|
-
- โ ๏ธ **Incomplete Installation**: Only one of the two required snippets present
|
|
608
|
-
|
|
609
|
-
## ๐ง Package Management
|
|
610
|
-
|
|
611
|
-
### Check package information
|
|
612
|
-
```bash
|
|
613
|
-
# Check current version
|
|
614
|
-
gbu-a11y --version
|
|
615
|
-
npm list -g gbu-accessibility-package
|
|
616
|
-
|
|
617
|
-
# View package info
|
|
618
|
-
npm info gbu-accessibility-package
|
|
619
|
-
|
|
620
|
-
# Verify installation
|
|
621
|
-
which gbu-a11y
|
|
622
|
-
npm list -g | grep gbu-accessibility-package
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### Update package
|
|
626
|
-
```bash
|
|
627
|
-
# Check for new versions
|
|
628
|
-
npm outdated -g gbu-accessibility-package
|
|
629
|
-
|
|
630
|
-
# Update to latest version
|
|
631
|
-
npm update -g gbu-accessibility-package
|
|
632
|
-
|
|
633
|
-
# Or reinstall latest version
|
|
634
|
-
npm uninstall -g gbu-accessibility-package
|
|
635
|
-
npm install -g gbu-accessibility-package@latest
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
### Cache management
|
|
639
|
-
```bash
|
|
640
|
-
# Verify cache
|
|
641
|
-
npm cache verify
|
|
642
|
-
|
|
643
|
-
# Clean cache (when having issues)
|
|
644
|
-
npm cache clean --force
|
|
645
|
-
|
|
646
|
-
# View cache location
|
|
647
|
-
npm config get cache
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
## ๐งช Testing and Demo
|
|
651
|
-
|
|
652
|
-
```bash
|
|
653
|
-
# Test the package
|
|
654
154
|
npm test
|
|
655
|
-
|
|
656
|
-
# Demo basic features
|
|
657
|
-
npm run demo
|
|
658
|
-
|
|
659
|
-
# Demo enhanced alt features
|
|
660
|
-
npm run demo-enhanced
|
|
661
|
-
|
|
662
|
-
# Demo creative alt generation
|
|
663
|
-
npm run demo-creative
|
|
664
|
-
|
|
665
|
-
# Test enhanced alt features
|
|
666
|
-
npm run test-enhanced-alt
|
|
155
|
+
npm pack
|
|
667
156
|
```
|
|
668
157
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
- **Basic Mode**: Fast processing, suitable for large projects
|
|
672
|
-
- **Enhanced Mode**: ~20-30% slower but 85-90% improvement in alt text quality
|
|
673
|
-
- **Memory Usage**: +15-20% for enhanced vocabulary and analysis
|
|
674
|
-
- **Accuracy**: 95%+ detection of accessibility issues
|
|
675
|
-
|
|
676
|
-
## ๐ Language Support
|
|
677
|
-
|
|
678
|
-
- **Japanese (ja)**: Default language with rich vocabulary
|
|
679
|
-
- **English (en)**: Comprehensive English support
|
|
680
|
-
- **Vietnamese (vi)**: Vietnamese language support
|
|
681
|
-
|
|
682
|
-
Enhanced alt features include language-specific vocabulary and grammar rules for natural, contextually appropriate descriptions.
|
|
683
|
-
|
|
684
|
-
## ๐ Documentation
|
|
685
|
-
|
|
686
|
-
- [Enhanced Alt Features Guide](./ENHANCED_ALT_FEATURES.md) - Detailed documentation for enhanced alt attribute features
|
|
687
|
-
- [Quick Start Guide](./QUICK_START.md) - Get started quickly
|
|
688
|
-
- [Package Summary](./PACKAGE_SUMMARY.md) - Overview of all features
|
|
689
|
-
- [Changelog](./CHANGELOG.md) - Version history and updates
|
|
690
|
-
|
|
691
|
-
## ๐ค Contributing
|
|
692
|
-
|
|
693
|
-
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
694
|
-
|
|
695
|
-
### Development Setup
|
|
696
|
-
|
|
697
|
-
```bash
|
|
698
|
-
git clone https://github.com/example/gbu-accessibility-tool.git
|
|
699
|
-
cd gbu-accessibility-tool/accessibility-package
|
|
700
|
-
npm install
|
|
701
|
-
npm test
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
## ๐ License
|
|
705
|
-
|
|
706
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
707
|
-
|
|
708
|
-
## ๐ Acknowledgments
|
|
709
|
-
|
|
710
|
-
- Built with accessibility best practices in mind
|
|
711
|
-
- Follows WCAG guidelines
|
|
712
|
-
- Inspired by the need for automated accessibility improvements
|
|
713
|
-
- Community feedback and contributions
|
|
158
|
+
Then verify:
|
|
714
159
|
|
|
715
|
-
|
|
160
|
+
- `gbu-a11y --help`
|
|
161
|
+
- `gbu-a11y`
|
|
162
|
+
- `gbu-a11y --full-report`
|
|
716
163
|
|
|
717
|
-
|
|
164
|
+
## License
|
|
718
165
|
|
|
719
|
-
|
|
166
|
+
MIT
|