gbu-accessibility-package 3.8.0 → 3.8.2
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 +40 -0
- package/README-vi.md +16 -10
- package/README.md +3 -0
- package/bin/fix.js +140 -0
- package/bin/test.js +71 -0
- package/cli.js +23 -1
- package/lib/fixer.js +504 -104
- package/package.json +4 -5
- package/ENHANCED_ALT_FEATURES.md +0 -230
- package/PACKAGE_SUMMARY.md +0 -191
- package/demo/1mb-jpg-example-file.jpg +0 -0
- package/demo/advanced-test.html +0 -44
- package/demo/aria-label-test.html +0 -32
- package/demo/broken-links-test.html +0 -41
- package/demo/comprehensive-test.html +0 -21
- package/demo/dead-code-test.css +0 -68
- package/demo/dead-code-test.html +0 -36
- package/demo/dead-code-test.js +0 -77
- package/demo/demo.js +0 -73
- package/demo/duplicate-roles.html +0 -45
- package/demo/enhanced-alt-test.html +0 -150
- package/demo/form-labels-test.html +0 -87
- package/demo/heading-structure-test.html +0 -60
- package/demo/heading-structure-test.html.backup +0 -60
- package/demo/large-file-demo.css +0 -213
- package/demo/nested-controls-test.html +0 -92
- package/demo/sample.html +0 -47
- package/demo/test-external-links.html +0 -26
- package/demo/unused-files-test.html +0 -31
- package/demo/unused-image.png +0 -1
- package/demo/unused-page.html +0 -11
- package/demo/unused-script.js +0 -12
- package/demo/unused-style.css +0 -10
- package/demo/very-large-file.js +0 -2
- package/example.js +0 -121
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gbu-accessibility-package",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "Comprehensive accessibility fixes and project optimization for HTML files. Smart context-aware alt text generation, form labels, button names, link names, landmarks, heading analysis, WCAG-compliant role attributes, unused files detection, dead code analysis, broken external links detection, and missing local resources detection. Covers major axe DevTools issues with individual fix modes.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"alt-only": "node cli.js --alt-only",
|
|
16
16
|
"lang-only": "node cli.js --lang-only",
|
|
17
17
|
"role-only": "node cli.js --role-only",
|
|
18
|
+
"aria-label-only": "node cli.js --aria-label-only",
|
|
18
19
|
"forms-only": "node cli.js --forms-only",
|
|
19
20
|
"buttons-only": "node cli.js --buttons-only",
|
|
20
21
|
"links-only": "node cli.js --links-only",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"cleanup-only": "node cli.js --cleanup-only",
|
|
30
31
|
"no-backup": "node cli.js --no-backup",
|
|
31
32
|
"cleanup-backups": "find . -name '*.backup' -type f -delete",
|
|
32
|
-
"test": "node test-package.
|
|
33
|
+
"test": "node test-package.cjs",
|
|
33
34
|
"test-enhanced-alt": "node test-enhanced-alt.js",
|
|
34
35
|
"demo": "node cli.js --dry-run demo",
|
|
35
36
|
"demo-enhanced": "node cli.js --enhanced-alt --dry-run demo",
|
|
@@ -82,16 +83,14 @@
|
|
|
82
83
|
},
|
|
83
84
|
"files": [
|
|
84
85
|
"lib/",
|
|
86
|
+
"bin/",
|
|
85
87
|
"index.js",
|
|
86
88
|
"cli.js",
|
|
87
|
-
"example.js",
|
|
88
|
-
"demo/",
|
|
89
89
|
"README.md",
|
|
90
90
|
"README-vi.md",
|
|
91
91
|
"CHANGELOG.md",
|
|
92
92
|
"QUICK_START.md",
|
|
93
93
|
"PACKAGE_SUMMARY.md",
|
|
94
|
-
"ENHANCED_ALT_FEATURES.md",
|
|
95
94
|
"LICENSE"
|
|
96
95
|
],
|
|
97
96
|
"dependencies": {
|
package/ENHANCED_ALT_FEATURES.md
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# Enhanced Alt Attribute Features
|
|
2
|
-
|
|
3
|
-
## Tổng quan
|
|
4
|
-
|
|
5
|
-
Enhanced Alt Attribute features là bộ tính năng cải tiến cho việc kiểm tra và tạo alt text đa dạng, thông minh hơn so với phiên bản cơ bản.
|
|
6
|
-
|
|
7
|
-
## Tính năng chính
|
|
8
|
-
|
|
9
|
-
### 🔍 **Phân tích toàn diện**
|
|
10
|
-
- **Phân loại hình ảnh**: Tự động phân loại hình ảnh theo mục đích (decorative, functional, complex, logo, data-visualization, etc.)
|
|
11
|
-
- **Kiểm tra chất lượng nội dung**: Phát hiện alt text quá dài/ngắn, từ thừa, generic text
|
|
12
|
-
- **Phân tích ngữ cảnh**: Hiểu context xung quanh hình ảnh để tạo alt text phù hợp
|
|
13
|
-
- **Kiểm tra tính nhất quán**: So sánh alt text với aria-label, title attributes
|
|
14
|
-
|
|
15
|
-
### 🎨 **Tạo alt text đa dạng**
|
|
16
|
-
- **Context-aware generation**: Dựa trên heading, paragraph, figcaption xung quanh
|
|
17
|
-
- **Semantic analysis**: Phân tích semantic từ src và context
|
|
18
|
-
- **Emotional context**: Thêm cảm xúc và tone phù hợp
|
|
19
|
-
- **Brand awareness**: Nhận diện và tích hợp thông tin thương hiệu
|
|
20
|
-
- **Technical descriptions**: Mô tả chuyên sâu cho biểu đồ, sơ đồ
|
|
21
|
-
|
|
22
|
-
### 🌐 **Đa ngôn ngữ**
|
|
23
|
-
- **Japanese (ja)**: Từ vựng phong phú, ngữ pháp chính xác
|
|
24
|
-
- **English (en)**: Vocabulary đa dạng, grammar tự nhiên
|
|
25
|
-
- **Vietnamese (vi)**: Hỗ trợ tiếng Việt với từ vựng phù hợp
|
|
26
|
-
|
|
27
|
-
## Cách sử dụng
|
|
28
|
-
|
|
29
|
-
### CLI Commands
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Bật enhanced alt mode
|
|
33
|
-
node cli.js --enhanced-alt
|
|
34
|
-
|
|
35
|
-
# Chọn mức độ creativity
|
|
36
|
-
node cli.js --enhanced-alt --alt-creativity conservative # Đơn giản, factual
|
|
37
|
-
node cli.js --enhanced-alt --alt-creativity balanced # Cân bằng (default)
|
|
38
|
-
node cli.js --enhanced-alt --alt-creativity creative # Phong phú, sáng tạo
|
|
39
|
-
|
|
40
|
-
# Thêm emotional context
|
|
41
|
-
node cli.js --enhanced-alt --include-emotions
|
|
42
|
-
|
|
43
|
-
# Kiểm tra strict quality
|
|
44
|
-
node cli.js --enhanced-alt --strict-alt
|
|
45
|
-
|
|
46
|
-
# Kết hợp các options
|
|
47
|
-
node cli.js --enhanced-alt --alt-creativity creative --include-emotions --strict-alt
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Programmatic Usage
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
const { AccessibilityFixer, EnhancedAltChecker } = require('gbu-accessibility-package');
|
|
54
|
-
|
|
55
|
-
// Sử dụng AccessibilityFixer với enhanced mode
|
|
56
|
-
const fixer = new AccessibilityFixer({
|
|
57
|
-
language: 'ja',
|
|
58
|
-
enhancedAltMode: true,
|
|
59
|
-
altCreativity: 'creative',
|
|
60
|
-
includeEmotions: true,
|
|
61
|
-
strictAltChecking: true
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
await fixer.fixEmptyAltAttributes('./src');
|
|
65
|
-
|
|
66
|
-
// Sử dụng EnhancedAltChecker riêng biệt
|
|
67
|
-
const checker = new EnhancedAltChecker({
|
|
68
|
-
language: 'en',
|
|
69
|
-
strictMode: true
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const issues = checker.analyzeAltAttributes(htmlContent);
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Ví dụ cải tiến
|
|
76
|
-
|
|
77
|
-
### Before (Basic mode):
|
|
78
|
-
```html
|
|
79
|
-
<img src="company-logo.png">
|
|
80
|
-
<!-- Generates: alt="ロゴ" -->
|
|
81
|
-
|
|
82
|
-
<img src="sales-chart.png" alt="">
|
|
83
|
-
<!-- Generates: alt="グラフ" -->
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### After (Enhanced mode):
|
|
87
|
-
```html
|
|
88
|
-
<img src="company-logo.png">
|
|
89
|
-
<!-- Generates: alt="Technology company logo" -->
|
|
90
|
-
|
|
91
|
-
<img src="sales-chart.png" alt="">
|
|
92
|
-
<!-- Context: "Sales increased 25% this quarter" -->
|
|
93
|
-
<!-- Generates: alt="Sales performance chart showing 25% increase" -->
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Creativity Levels
|
|
97
|
-
|
|
98
|
-
### Conservative
|
|
99
|
-
- Mô tả đơn giản, factual
|
|
100
|
-
- Tập trung vào chức năng cơ bản
|
|
101
|
-
- Ít từ vựng đa dạng
|
|
102
|
-
|
|
103
|
-
**Example**: `alt="Chart"`, `alt="Logo"`
|
|
104
|
-
|
|
105
|
-
### Balanced (Default)
|
|
106
|
-
- Context-aware descriptions
|
|
107
|
-
- Vừa phải về creativity
|
|
108
|
-
- Cân bằng giữa đơn giản và chi tiết
|
|
109
|
-
|
|
110
|
-
**Example**: `alt="Sales performance chart"`, `alt="Company logo"`
|
|
111
|
-
|
|
112
|
-
### Creative
|
|
113
|
-
- Mô tả phong phú, chi tiết
|
|
114
|
-
- Tích hợp emotional context
|
|
115
|
-
- Brand và context awareness cao
|
|
116
|
-
|
|
117
|
-
**Example**: `alt="Dynamic sales performance chart showing impressive 25% quarterly growth"`, `alt="Innovative technology company logo representing digital transformation"`
|
|
118
|
-
|
|
119
|
-
## Image Type Classification
|
|
120
|
-
|
|
121
|
-
### Decorative Images
|
|
122
|
-
- **Detection**: Border, pattern, texture images
|
|
123
|
-
- **Recommendation**: `alt=""`
|
|
124
|
-
- **Rationale**: Không cần mô tả cho screen readers
|
|
125
|
-
|
|
126
|
-
### Functional Icons
|
|
127
|
-
- **Detection**: Icons trong buttons, links
|
|
128
|
-
- **Recommendation**: Mô tả chức năng
|
|
129
|
-
- **Example**: `alt="Open chat"`, `alt="Search"`
|
|
130
|
-
|
|
131
|
-
### Data Visualizations
|
|
132
|
-
- **Detection**: Charts, graphs, diagrams
|
|
133
|
-
- **Recommendation**: Mô tả loại + xu hướng + data
|
|
134
|
-
- **Example**: `alt="Bar chart showing 40% increase in user engagement"`
|
|
135
|
-
|
|
136
|
-
### Complex Images
|
|
137
|
-
- **Detection**: Flowcharts, maps, architectural diagrams
|
|
138
|
-
- **Recommendation**: Alt ngắn + longdesc hoặc mô tả chi tiết
|
|
139
|
-
- **Example**: `alt="System architecture diagram"` + detailed description
|
|
140
|
-
|
|
141
|
-
### Logos
|
|
142
|
-
- **Detection**: Logo keywords, brand context
|
|
143
|
-
- **Recommendation**: Brand name + "logo"
|
|
144
|
-
- **Example**: `alt="Microsoft logo"`, `alt="GBU company logo"`
|
|
145
|
-
|
|
146
|
-
## Quality Checks
|
|
147
|
-
|
|
148
|
-
### Error Level Issues
|
|
149
|
-
- ❌ **Missing alt attribute**
|
|
150
|
-
- ❌ **Empty alt for content images**
|
|
151
|
-
- ❌ **Generic alt text** ("click here", "read more")
|
|
152
|
-
- ❌ **Missing data description** (for charts without trend info)
|
|
153
|
-
|
|
154
|
-
### Warning Level Issues
|
|
155
|
-
- ⚠️ **Alt text too long** (>125 characters)
|
|
156
|
-
- ⚠️ **Alt text too short** (<3 characters for content)
|
|
157
|
-
- ⚠️ **Redundant words** ("image", "picture", "photo")
|
|
158
|
-
- ⚠️ **Filename in alt text**
|
|
159
|
-
- ⚠️ **Inconsistent labels** (alt ≠ aria-label)
|
|
160
|
-
|
|
161
|
-
### Info Level Issues
|
|
162
|
-
- ℹ️ **Redundant title attribute**
|
|
163
|
-
- ℹ️ **Optimization suggestions**
|
|
164
|
-
|
|
165
|
-
## Testing
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
# Test enhanced features
|
|
169
|
-
npm run test-enhanced-alt
|
|
170
|
-
|
|
171
|
-
# Demo enhanced mode
|
|
172
|
-
npm run demo-enhanced
|
|
173
|
-
|
|
174
|
-
# Demo creative mode
|
|
175
|
-
npm run demo-creative
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Configuration Options
|
|
179
|
-
|
|
180
|
-
```javascript
|
|
181
|
-
{
|
|
182
|
-
// Enhanced mode settings
|
|
183
|
-
enhancedAltMode: true, // Enable enhanced features
|
|
184
|
-
altCreativity: 'balanced', // conservative|balanced|creative
|
|
185
|
-
includeEmotions: false, // Add emotional descriptors
|
|
186
|
-
strictAltChecking: false, // Strict quality checking
|
|
187
|
-
|
|
188
|
-
// Alt generation settings
|
|
189
|
-
maxAltLength: 125, // Maximum alt text length
|
|
190
|
-
minAltLength: 3, // Minimum alt text length
|
|
191
|
-
checkDecorative: true, // Check decorative images
|
|
192
|
-
checkInformative: true, // Check informative images
|
|
193
|
-
checkComplex: true, // Check complex images
|
|
194
|
-
|
|
195
|
-
// Language and context
|
|
196
|
-
language: 'ja', // ja|en|vi
|
|
197
|
-
includeBrandContext: true, // Include brand information
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Performance Impact
|
|
202
|
-
|
|
203
|
-
- **Enhanced mode**: ~20-30% slower due to comprehensive analysis
|
|
204
|
-
- **Memory usage**: +15-20% for vocabulary and analysis
|
|
205
|
-
- **Accuracy**: 85-90% improvement in alt text quality
|
|
206
|
-
- **Coverage**: 95%+ detection of alt attribute issues
|
|
207
|
-
|
|
208
|
-
## Roadmap
|
|
209
|
-
|
|
210
|
-
### v3.2.0 (Planned)
|
|
211
|
-
- [ ] AI-powered image content analysis
|
|
212
|
-
- [ ] Custom vocabulary support
|
|
213
|
-
- [ ] Batch alt text review interface
|
|
214
|
-
- [ ] Integration with design systems
|
|
215
|
-
|
|
216
|
-
### v3.3.0 (Future)
|
|
217
|
-
- [ ] Real-time alt text suggestions
|
|
218
|
-
- [ ] Visual alt text editor
|
|
219
|
-
- [ ] Accessibility score calculation
|
|
220
|
-
- [ ] Team collaboration features
|
|
221
|
-
|
|
222
|
-
## Contributing
|
|
223
|
-
|
|
224
|
-
Enhanced alt features được phát triển với focus vào:
|
|
225
|
-
1. **Accuracy**: Alt text chính xác, phù hợp context
|
|
226
|
-
2. **Diversity**: Đa dạng trong cách mô tả
|
|
227
|
-
3. **Usability**: Dễ sử dụng, configuration linh hoạt
|
|
228
|
-
4. **Performance**: Tối ưu tốc độ xử lý
|
|
229
|
-
|
|
230
|
-
Contributions welcome! Please see main README for guidelines.
|
package/PACKAGE_SUMMARY.md
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
# 📦 Accessibility Fixer Package - Summary
|
|
2
|
-
|
|
3
|
-
## 🎯 Mục đích
|
|
4
|
-
|
|
5
|
-
Tool tự động sửa các vấn đề accessibility phổ biến trong HTML files, giúp website tuân thủ WCAG guidelines.
|
|
6
|
-
|
|
7
|
-
## 📁 Cấu trúc Package
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
accessibility-package/
|
|
11
|
-
├── lib/
|
|
12
|
-
│ └── fixer.js # Core logic
|
|
13
|
-
├── demo/
|
|
14
|
-
│ └── sample.html # File demo để test
|
|
15
|
-
├── cli.js # Command line interface
|
|
16
|
-
├── example.js # Ví dụ sử dụng
|
|
17
|
-
├── package.json # Package configuration
|
|
18
|
-
├── README.md # Hướng dẫn đầy đủ
|
|
19
|
-
├── QUICK_START.md # Hướng dẫn nhanh
|
|
20
|
-
└── PACKAGE_SUMMARY.md # File này
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## ✨ Tính năng chính
|
|
25
|
-
|
|
26
|
-
### 1. Alt Attributes
|
|
27
|
-
|
|
28
|
-
- ✅ Tự động thêm alt text cho images thiếu
|
|
29
|
-
- ✅ Sửa empty alt attributes
|
|
30
|
-
- ✅ Context-aware: phân tích nội dung xung quanh để tạo alt text phù hợp
|
|
31
|
-
- ✅ Hỗ trợ nhiều ngôn ngữ (ja, en, vi, zh, etc.)
|
|
32
|
-
|
|
33
|
-
### 2. Lang Attributes
|
|
34
|
-
|
|
35
|
-
- ✅ Thêm lang attribute cho thẻ `<html>`
|
|
36
|
-
- ✅ Configurable language
|
|
37
|
-
|
|
38
|
-
### 3. Role Attributes
|
|
39
|
-
|
|
40
|
-
- ✅ `role="img"` cho tất cả thẻ `<img>`
|
|
41
|
-
- ✅ `role="link"` cho thẻ `<a>`
|
|
42
|
-
- ✅ `role="button"` cho elements có onclick
|
|
43
|
-
- ✅ `role="menubar"` và `role="menuitem"` cho navigation
|
|
44
|
-
- ✅ Tự động detect clickable elements
|
|
45
|
-
|
|
46
|
-
## 🚀 Cách sử dụng
|
|
47
|
-
|
|
48
|
-
### Option 1: CLI (Đơn giản)
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
node accessibility-package/cli.js
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Option 2: Node.js
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
const AccessibilityFixer = require("./accessibility-package/lib/fixer.js");
|
|
58
|
-
const fixer = new AccessibilityFixer({ language: "ja" });
|
|
59
|
-
await fixer.fixRoleAttributes(".");
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Option 3: NPM Scripts
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"scripts": {
|
|
67
|
-
"fix-a11y": "node accessibility-package/cli.js",
|
|
68
|
-
"preview-a11y": "node accessibility-package/cli.js --dry-run"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## 📊 Kết quả Demo
|
|
74
|
-
|
|
75
|
-
Với file demo, tool đã tìm và sửa:
|
|
76
|
-
|
|
77
|
-
- **16 issues** tổng cộng
|
|
78
|
-
- **1 lang attribute** missing
|
|
79
|
-
- **3 alt attributes** missing/empty
|
|
80
|
-
- **12 role attributes** missing
|
|
81
|
-
|
|
82
|
-
## ⚙️ Configuration
|
|
83
|
-
|
|
84
|
-
```javascript
|
|
85
|
-
{
|
|
86
|
-
language: 'ja', // 'ja', 'en', 'vi', 'zh', etc.
|
|
87
|
-
backupFiles: true, // Tạo .backup files
|
|
88
|
-
dryRun: false // Preview mode
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## 🎨 Before/After Example
|
|
93
|
-
|
|
94
|
-
### Before:
|
|
95
|
-
|
|
96
|
-
```html
|
|
97
|
-
<html>
|
|
98
|
-
<img src="logo.png" />
|
|
99
|
-
<a href="/about">About</a>
|
|
100
|
-
<button onclick="submit()">Submit</button>
|
|
101
|
-
</html>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### After:
|
|
105
|
-
|
|
106
|
-
```html
|
|
107
|
-
<html lang="ja">
|
|
108
|
-
<img src="logo.png" alt="ロゴ" role="img" />
|
|
109
|
-
<a href="/about" role="link">About</a>
|
|
110
|
-
<button onclick="submit()" role="button">Submit</button>
|
|
111
|
-
</html>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## 🔧 Customization
|
|
115
|
-
|
|
116
|
-
### Thay đổi alt text generation
|
|
117
|
-
|
|
118
|
-
Sửa method `generateAltText()` trong `lib/fixer.js`
|
|
119
|
-
|
|
120
|
-
### Thêm role rules mới
|
|
121
|
-
|
|
122
|
-
Sửa method `fixRoleAttributesInContent()` trong `lib/fixer.js`
|
|
123
|
-
|
|
124
|
-
### Thay đổi ngôn ngữ
|
|
125
|
-
|
|
126
|
-
Set `language` parameter trong config
|
|
127
|
-
|
|
128
|
-
## 📈 Performance
|
|
129
|
-
|
|
130
|
-
- ✅ Xử lý hàng trăm files trong vài giây
|
|
131
|
-
- ✅ Memory efficient
|
|
132
|
-
- ✅ Backup tự động
|
|
133
|
-
- ✅ Error handling tốt
|
|
134
|
-
|
|
135
|
-
## 🛡️ Safety Features
|
|
136
|
-
|
|
137
|
-
- ✅ Dry run mode để preview
|
|
138
|
-
- ✅ Automatic backups (.backup files)
|
|
139
|
-
- ✅ Duplicate attribute prevention
|
|
140
|
-
- ✅ Error handling và logging
|
|
141
|
-
|
|
142
|
-
## 📋 Checklist sử dụng
|
|
143
|
-
|
|
144
|
-
1. [ ] Copy package vào dự án
|
|
145
|
-
2. [ ] `npm install` dependencies
|
|
146
|
-
3. [ ] Backup code (git commit)
|
|
147
|
-
4. [ ] Test với `--dry-run`
|
|
148
|
-
5. [ ] Chạy tool
|
|
149
|
-
6. [ ] Review kết quả
|
|
150
|
-
7. [ ] Commit changes
|
|
151
|
-
|
|
152
|
-
## 🎯 Use Cases
|
|
153
|
-
|
|
154
|
-
### Dự án mới
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
node accessibility-package/cli.js ./src
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Dự án có sẵn
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
node accessibility-package/cli.js --dry-run ./public
|
|
164
|
-
# Review results, then:
|
|
165
|
-
node accessibility-package/cli.js ./public
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### CI/CD Integration
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
# In build script
|
|
172
|
-
node accessibility-package/cli.js --no-backup ./dist
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## 📞 Support
|
|
176
|
-
|
|
177
|
-
- 📖 Đọc [README.md](./README.md) để biết chi tiết
|
|
178
|
-
- 🚀 Xem [QUICK_START.md](./QUICK_START.md) để bắt đầu nhanh
|
|
179
|
-
- 💡 Chạy [example.js](./example.js) để xem demos
|
|
180
|
-
- ❓ Chạy `node cli.js --help` để xem options
|
|
181
|
-
|
|
182
|
-
## 🎉 Kết luận
|
|
183
|
-
|
|
184
|
-
Package này giúp bạn:
|
|
185
|
-
|
|
186
|
-
- ⚡ **Tiết kiệm thời gian**: Tự động fix thay vì manual
|
|
187
|
-
- 🎯 **Cải thiện accessibility**: Tuân thủ WCAG guidelines
|
|
188
|
-
- 🛡️ **An toàn**: Backup và preview trước khi apply
|
|
189
|
-
- 🔧 **Linh hoạt**: Dễ customize và integrate
|
|
190
|
-
|
|
191
|
-
**Ready to make your website more accessible! 🌟**
|
|
Binary file
|
package/demo/advanced-test.html
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Advanced Accessibility Test</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>Advanced Accessibility Test</h1>
|
|
9
|
-
|
|
10
|
-
<!-- Form issues -->
|
|
11
|
-
<form>
|
|
12
|
-
<input type="text" placeholder="Name" aria-label="Name" title="Name" id="text_019747">
|
|
13
|
-
<input type="email" id="email" aria-label="メールアドレス" title="メールアドレス">
|
|
14
|
-
<input type="password" aria-label="パスワード" title="パスワード" id="password_019747">
|
|
15
|
-
<input type="submit">
|
|
16
|
-
</form>
|
|
17
|
-
|
|
18
|
-
<!-- Button issues -->
|
|
19
|
-
<button aria-label="ボタン" title="ボタン"></button>
|
|
20
|
-
<button onclick="alert('test')" role="button" aria-label="ボタン" title="ボタン"></button>
|
|
21
|
-
<input type="button">
|
|
22
|
-
|
|
23
|
-
<!-- Link issues -->
|
|
24
|
-
<a href="/home" role="link" aria-label="リンク" title="リンク"></a>
|
|
25
|
-
<a href="/more" role="link">Click here</a>
|
|
26
|
-
<a href="/read" role="link">Read more</a>
|
|
27
|
-
<a href="/image" role="link" aria-label="リンク" title="リンク"><img src="icon.png" alt="Skipped h2" role="img" aria-label="Skipped h2"></a>
|
|
28
|
-
|
|
29
|
-
<!-- Heading issues -->
|
|
30
|
-
<h3>Skipped h2</h3>
|
|
31
|
-
<h1>Second h1</h1>
|
|
32
|
-
<h4></h4>
|
|
33
|
-
|
|
34
|
-
<!-- Landmark issues -->
|
|
35
|
-
<div class="content">
|
|
36
|
-
<p>Main content without landmark</p>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<ul class="navigation" role="menubar">
|
|
40
|
-
<li><a href="/home" role="link">Home</a></li>
|
|
41
|
-
<li><a href="/about" role="link">About</a></li>
|
|
42
|
-
</ul>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Aria Label Test</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Aria Label Test Cases</h1>
|
|
10
|
-
|
|
11
|
-
<!-- Test case 1: Image with alt but no aria-label -->
|
|
12
|
-
<img src="test1.jpg" alt="Test image 1" role="img" aria-label="Test image 1">
|
|
13
|
-
|
|
14
|
-
<!-- Test case 2: Image with alt and existing aria-label (should not change) -->
|
|
15
|
-
<img src="test2.jpg" alt="Test image 2" aria-label="Custom label" role="img">
|
|
16
|
-
|
|
17
|
-
<!-- Test case 3: Image with empty alt (should not add aria-label) -->
|
|
18
|
-
<img src="test3.jpg" alt="Aria Label Test Cases" role="img" aria-label="Aria Label Test Cases">
|
|
19
|
-
|
|
20
|
-
<!-- Test case 4: Image without alt (should generate alt and aria-label) -->
|
|
21
|
-
<img src="logo.png" role="img" alt="ロゴ" aria-label="ロゴ">
|
|
22
|
-
|
|
23
|
-
<!-- Test case 5: Picture with role and img with alt -->
|
|
24
|
-
<picture>
|
|
25
|
-
<source srcset="responsive.webp" type="image/webp">
|
|
26
|
-
<img src="responsive.jpg" alt="Responsive image" role="img" aria-label="Responsive image">
|
|
27
|
-
</picture>
|
|
28
|
-
|
|
29
|
-
<!-- Test case 6: Image with role but no aria-label -->
|
|
30
|
-
<img src="test6.jpg" alt="Test image 6" role="img" aria-label="Test image 6">
|
|
31
|
-
</body>
|
|
32
|
-
</html>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Broken Links Test</title>
|
|
6
|
-
<!-- Broken CSS -->
|
|
7
|
-
<link rel="stylesheet" href="missing-style.css">
|
|
8
|
-
<!-- Working CSS (if exists) -->
|
|
9
|
-
<link rel="stylesheet" href="../package.json">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<h1>Broken Links Test</h1>
|
|
13
|
-
|
|
14
|
-
<!-- Working local link -->
|
|
15
|
-
<a href="advanced-test.html" role="link">Working local link</a>
|
|
16
|
-
|
|
17
|
-
<!-- Broken local link -->
|
|
18
|
-
<a href="non-existent-page.html" role="link">Broken local link</a>
|
|
19
|
-
|
|
20
|
-
<!-- Working external link -->
|
|
21
|
-
<a href="https://www.google.com" role="link">Working external link</a>
|
|
22
|
-
|
|
23
|
-
<!-- Broken external link -->
|
|
24
|
-
<a href="https://this-domain-does-not-exist-12345.com" role="link">Broken external link</a>
|
|
25
|
-
|
|
26
|
-
<!-- Working image -->
|
|
27
|
-
<img src="advanced-test.html" alt="Working image reference" role="img" aria-label="Working image reference">
|
|
28
|
-
|
|
29
|
-
<!-- Broken image -->
|
|
30
|
-
<img src="missing-image.jpg" alt="Broken image" role="img" aria-label="Broken image">
|
|
31
|
-
|
|
32
|
-
<!-- Broken script -->
|
|
33
|
-
<script src="missing-script.js"></script>
|
|
34
|
-
|
|
35
|
-
<!-- Skip patterns -->
|
|
36
|
-
<a href="#anchor" role="link">Anchor link (should skip)</a>
|
|
37
|
-
<a href="mailto:test@example.com" role="link">Email link (should skip)</a>
|
|
38
|
-
<a href="tel:+1234567890" role="link">Phone link (should skip)</a>
|
|
39
|
-
<a href="javascript:void(0)" role="link">JavaScript link (should skip)</a>
|
|
40
|
-
</body>
|
|
41
|
-
</html>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Comprehensive Test</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>Comprehensive Test File</h1>
|
|
9
|
-
|
|
10
|
-
<!-- Missing alt -->
|
|
11
|
-
<img src="test.jpg" alt="Comprehensive Test File" role="img" aria-label="Comprehensive Test File">
|
|
12
|
-
|
|
13
|
-
<!-- Missing role -->
|
|
14
|
-
<a href="/home" role="link">Home</a>
|
|
15
|
-
|
|
16
|
-
<!-- Duplicate roles -->
|
|
17
|
-
<img src="dup.jpg" alt="Duplicate" role="img" aria-label="Duplicate">
|
|
18
|
-
|
|
19
|
-
<p>This tests comprehensive mode as default.</p>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
package/demo/dead-code-test.css
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/* CSS file with mixed used and unused rules */
|
|
2
|
-
|
|
3
|
-
/* Used classes - these appear in HTML */
|
|
4
|
-
.header {
|
|
5
|
-
background-color: #333;
|
|
6
|
-
color: white;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.content {
|
|
10
|
-
padding: 20px;
|
|
11
|
-
margin: 0 auto;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* Unused classes - these don't appear in any HTML */
|
|
15
|
-
.sidebar {
|
|
16
|
-
width: 300px;
|
|
17
|
-
background: #f0f0f0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.popup {
|
|
21
|
-
position: fixed;
|
|
22
|
-
top: 50%;
|
|
23
|
-
left: 50%;
|
|
24
|
-
transform: translate(-50%, -50%);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.modal-overlay {
|
|
28
|
-
background: rgba(0, 0, 0, 0.5);
|
|
29
|
-
position: fixed;
|
|
30
|
-
top: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
right: 0;
|
|
33
|
-
bottom: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Used tag selectors */
|
|
37
|
-
h1 {
|
|
38
|
-
font-size: 2em;
|
|
39
|
-
margin-bottom: 1em;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
p {
|
|
43
|
-
line-height: 1.6;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/* Unused tag selectors */
|
|
47
|
-
article {
|
|
48
|
-
margin: 20px 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
aside {
|
|
52
|
-
float: right;
|
|
53
|
-
width: 250px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* Dynamic classes that should be skipped */
|
|
57
|
-
.active {
|
|
58
|
-
color: red;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.hidden {
|
|
62
|
-
display: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* Pseudo-classes that should be skipped */
|
|
66
|
-
.button:hover {
|
|
67
|
-
background-color: #007bff;
|
|
68
|
-
}
|