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/demo/dead-code-test.html
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Dead Code Test</title>
|
|
6
|
-
<link rel="stylesheet" href="dead-code-test.css">
|
|
7
|
-
<script src="dead-code-test.js"></script>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<!-- Uses .header and .content classes from CSS -->
|
|
11
|
-
<div class="header">
|
|
12
|
-
<h1>Dead Code Analysis Test</h1>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<div class="content">
|
|
16
|
-
<p>This page uses some CSS classes and JavaScript functions, but not all of them.</p>
|
|
17
|
-
|
|
18
|
-
<!-- Button that calls showAlert() function -->
|
|
19
|
-
<button onclick="showAlert()" role="button">Click me (uses showAlert function)</button>
|
|
20
|
-
|
|
21
|
-
<!-- Button with event handler -->
|
|
22
|
-
<button onclick="handleClick(event)" role="button">Handle Click</button>
|
|
23
|
-
|
|
24
|
-
<p>Run <code>gbu-a11y --dead-code</code> to analyze which CSS rules and JavaScript functions are unused.</p>
|
|
25
|
-
|
|
26
|
-
<!-- Note: The following are used:
|
|
27
|
-
CSS: .header, .content, h1, p (tag selectors)
|
|
28
|
-
JS: showAlert(), handleClick(), and their dependencies
|
|
29
|
-
|
|
30
|
-
The following should be detected as unused:
|
|
31
|
-
CSS: .sidebar, .popup, .modal-overlay, article, aside
|
|
32
|
-
JS: unusedFunction(), complexUnusedFunction(), unusedVariable, etc.
|
|
33
|
-
-->
|
|
34
|
-
</div>
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|
package/demo/dead-code-test.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// JavaScript file with mixed used and unused code
|
|
2
|
-
|
|
3
|
-
// Used function - called in HTML onclick
|
|
4
|
-
function showAlert() {
|
|
5
|
-
alert('This function is used!');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Used function - called by another function
|
|
9
|
-
function helperFunction() {
|
|
10
|
-
return 'Helper function result';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Used function - calls helperFunction
|
|
14
|
-
function mainFunction() {
|
|
15
|
-
const result = helperFunction();
|
|
16
|
-
console.log(result);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Unused function - never called anywhere
|
|
20
|
-
function unusedFunction() {
|
|
21
|
-
console.log('This function is never called');
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Unused function - complex but never used
|
|
26
|
-
function complexUnusedFunction(param1, param2) {
|
|
27
|
-
const calculations = param1 * param2 + Math.random();
|
|
28
|
-
if (calculations > 0.5) {
|
|
29
|
-
return 'High value';
|
|
30
|
-
} else {
|
|
31
|
-
return 'Low value';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Used variable
|
|
36
|
-
const usedVariable = 'This variable is used below';
|
|
37
|
-
console.log(usedVariable);
|
|
38
|
-
|
|
39
|
-
// Unused variable - declared but never used
|
|
40
|
-
const unusedVariable = 'This variable is never used';
|
|
41
|
-
|
|
42
|
-
// Unused variable with complex initialization
|
|
43
|
-
const anotherUnusedVariable = {
|
|
44
|
-
property1: 'value1',
|
|
45
|
-
property2: 'value2',
|
|
46
|
-
method: function() {
|
|
47
|
-
return 'method result';
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Arrow function assigned to variable - used
|
|
52
|
-
const usedArrowFunction = () => {
|
|
53
|
-
return 'Arrow function result';
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Call the used arrow function
|
|
57
|
-
usedArrowFunction();
|
|
58
|
-
|
|
59
|
-
// Arrow function assigned to variable - unused
|
|
60
|
-
const unusedArrowFunction = (x, y) => {
|
|
61
|
-
return x + y;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// Event handler - should be detectable as used if referenced in HTML
|
|
65
|
-
function handleClick(event) {
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
console.log('Click handled');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Initialize app - commonly used pattern
|
|
71
|
-
function initApp() {
|
|
72
|
-
console.log('App initialized');
|
|
73
|
-
mainFunction();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Call init - this makes initApp used
|
|
77
|
-
initApp();
|
package/demo/demo.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Demo script to test accessibility package functionality
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const { AccessibilityTester, AccessibilityFixer } = require('../index');
|
|
9
|
-
const chalk = require('chalk');
|
|
10
|
-
|
|
11
|
-
async function runDemo() {
|
|
12
|
-
console.log(chalk.blue('🚀 Accessibility Package Demo'));
|
|
13
|
-
console.log(chalk.blue('===============================\n'));
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
// Test the fixer first
|
|
17
|
-
console.log(chalk.yellow('1. Testing Accessibility Fixer...'));
|
|
18
|
-
const fixer = new AccessibilityFixer({
|
|
19
|
-
language: 'ja',
|
|
20
|
-
dryRun: true // Don't actually modify files in demo
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Go to parent directory to find HTML files
|
|
24
|
-
const projectRoot = path.join(__dirname, '../..');
|
|
25
|
-
|
|
26
|
-
console.log(chalk.gray(` Scanning directory: ${projectRoot}`));
|
|
27
|
-
|
|
28
|
-
const langResults = await fixer.fixHtmlLang(projectRoot);
|
|
29
|
-
console.log(chalk.green(` ✅ Lang attribute check: ${langResults.length} files scanned`));
|
|
30
|
-
|
|
31
|
-
const altResults = await fixer.fixEmptyAltAttributes(projectRoot);
|
|
32
|
-
console.log(chalk.green(` ✅ Alt attribute check: ${altResults.length} files scanned`));
|
|
33
|
-
|
|
34
|
-
const mainSuggestions = await fixer.addMainLandmarks(projectRoot);
|
|
35
|
-
console.log(chalk.green(` ✅ Main landmark check: ${mainSuggestions.length} suggestions`));
|
|
36
|
-
|
|
37
|
-
console.log(chalk.yellow('\n2. Testing Accessibility Tester...'));
|
|
38
|
-
|
|
39
|
-
// Find HTML files in project
|
|
40
|
-
const fs = require('fs').promises;
|
|
41
|
-
const files = await fs.readdir(projectRoot);
|
|
42
|
-
const htmlFiles = files.filter(f => f.endsWith('.html')).slice(0, 3); // Test first 3 files
|
|
43
|
-
|
|
44
|
-
if (htmlFiles.length > 0) {
|
|
45
|
-
console.log(chalk.gray(` Found HTML files: ${htmlFiles.join(', ')}`));
|
|
46
|
-
|
|
47
|
-
const tester = new AccessibilityTester({
|
|
48
|
-
baseUrl: 'http://localhost:8080',
|
|
49
|
-
outputDir: path.join(projectRoot, 'accessibility-reports'),
|
|
50
|
-
pages: htmlFiles,
|
|
51
|
-
serverPort: 8080
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
console.log(chalk.gray(' Note: Actual testing requires a running server'));
|
|
55
|
-
console.log(chalk.green(' ✅ Tester configuration ready'));
|
|
56
|
-
} else {
|
|
57
|
-
console.log(chalk.yellow(' ⚠️ No HTML files found for testing'));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
console.log(chalk.green('\n✅ Demo completed successfully!'));
|
|
61
|
-
console.log(chalk.blue('\n📋 Package is working correctly. You can now use:'));
|
|
62
|
-
console.log(chalk.white(' a11y-fix all --dry-run # Preview fixes'));
|
|
63
|
-
console.log(chalk.white(' a11y-fix all # Apply fixes'));
|
|
64
|
-
console.log(chalk.white(' a11y-test run # Run accessibility tests'));
|
|
65
|
-
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error(chalk.red(`❌ Demo failed: ${error.message}`));
|
|
68
|
-
console.error(chalk.gray(error.stack));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
runDemo();
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ja">
|
|
3
|
-
<head>
|
|
4
|
-
<title>Test Duplicate Roles</title>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<h1>Test Duplicate Role Attributes</h1>
|
|
8
|
-
|
|
9
|
-
<!-- Images with duplicate roles -->
|
|
10
|
-
<img src="logo.png" alt="Logo" role="img" aria-label="Logo">
|
|
11
|
-
<img src="banner.jpg" alt="Banner" role="img" aria-label="Banner">
|
|
12
|
-
|
|
13
|
-
<!-- Links with duplicate roles -->
|
|
14
|
-
<a href="/home" role="link">Home</a>
|
|
15
|
-
<a href="/about" role="link">About</a>
|
|
16
|
-
|
|
17
|
-
<!-- Buttons with duplicate roles -->
|
|
18
|
-
<button onclick="submit()" role="button">Submit</button>
|
|
19
|
-
<button type="button" role="button">Click Me</button>
|
|
20
|
-
|
|
21
|
-
<!-- Mixed quotes -->
|
|
22
|
-
<div onclick="toggle()" role="button">Toggle</div>
|
|
23
|
-
<span onclick="show()" role='button'>Show</span>
|
|
24
|
-
|
|
25
|
-
<!-- Navigation with duplicates -->
|
|
26
|
-
<nav>
|
|
27
|
-
<ul class="nav-menu" role="menubar">
|
|
28
|
-
<li class="nav-item" role="menuitem">
|
|
29
|
-
<a href="/products" role="link">Products</a>
|
|
30
|
-
</li>
|
|
31
|
-
<li class="nav-item" role="menuitem">
|
|
32
|
-
<a href="/services" role="link">Services</a>
|
|
33
|
-
</li>
|
|
34
|
-
</ul>
|
|
35
|
-
</nav>
|
|
36
|
-
|
|
37
|
-
<!-- Complex duplicates -->
|
|
38
|
-
<article>
|
|
39
|
-
<h2>Article with Issues</h2>
|
|
40
|
-
<img src="article1.jpg" alt="Article Image" role="img" aria-label="Article Image">
|
|
41
|
-
<p>Some content...</p>
|
|
42
|
-
<a href="/read-more" role="link">Read More</a>
|
|
43
|
-
</article>
|
|
44
|
-
</body>
|
|
45
|
-
</html>
|
|
@@ -1,150 +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>Enhanced Alt Attribute Test Cases</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<header>
|
|
10
|
-
<h1>Enhanced Alt Attribute Testing</h1>
|
|
11
|
-
<p>Test cases for diverse alt attribute checking and generation</p>
|
|
12
|
-
</header>
|
|
13
|
-
|
|
14
|
-
<main>
|
|
15
|
-
<!-- Test Case 1: Missing alt attribute -->
|
|
16
|
-
<section>
|
|
17
|
-
<h2>Company Logo</h2>
|
|
18
|
-
<p>Welcome to our innovative technology company</p>
|
|
19
|
-
<img src="company-logo.png" width="200" height="100" alt="Company Logo" role="img" aria-label="Company Logo">
|
|
20
|
-
</section>
|
|
21
|
-
|
|
22
|
-
<!-- Test Case 2: Empty alt attribute for content image -->
|
|
23
|
-
<section>
|
|
24
|
-
<h2>Product Showcase</h2>
|
|
25
|
-
<p>Our latest smartphone with advanced features</p>
|
|
26
|
-
<img src="smartphone-product.jpg" alt="Product Showcase" width="300" height="200" role="img" aria-label="Product Showcase">
|
|
27
|
-
</section>
|
|
28
|
-
|
|
29
|
-
<!-- Test Case 3: Alt text too long -->
|
|
30
|
-
<section>
|
|
31
|
-
<h2>Team Photo</h2>
|
|
32
|
-
<img src="team-photo.jpg" alt="This is a very long description of our amazing team photo showing all the wonderful people who work at our company including engineers, designers, managers, and other staff members working together in our beautiful modern office space" width="400" height="300" role="img" aria-label="This is a very long description of our amazing team photo showing all the wonderful people who work at our company including engineers, designers, managers, and other staff members working together in our beautiful modern office space">
|
|
33
|
-
</section>
|
|
34
|
-
|
|
35
|
-
<!-- Test Case 4: Alt text with redundant words -->
|
|
36
|
-
<section>
|
|
37
|
-
<h2>Office Environment</h2>
|
|
38
|
-
<img src="office.jpg" alt="Image of office picture showing workplace photo" width="350" height="250" role="img" aria-label="Image of office picture showing workplace photo">
|
|
39
|
-
</section>
|
|
40
|
-
|
|
41
|
-
<!-- Test Case 5: Generic alt text -->
|
|
42
|
-
<section>
|
|
43
|
-
<h2>Learn More</h2>
|
|
44
|
-
<p>Discover our services</p>
|
|
45
|
-
<a href="/services" role="link" aria-label="リンク" title="リンク">
|
|
46
|
-
<img src="arrow-right.png" alt="Click here" width="24" height="24" role="img" aria-label="Click here">
|
|
47
|
-
</a>
|
|
48
|
-
</section>
|
|
49
|
-
|
|
50
|
-
<!-- Test Case 6: Data visualization without proper description -->
|
|
51
|
-
<section>
|
|
52
|
-
<h2>Sales Performance</h2>
|
|
53
|
-
<p>Our sales increased by 25% this quarter</p>
|
|
54
|
-
<img src="sales-chart.png" alt="Chart" width="500" height="300" role="img" aria-label="Chart">
|
|
55
|
-
</section>
|
|
56
|
-
|
|
57
|
-
<!-- Test Case 7: Decorative image with content alt -->
|
|
58
|
-
<section>
|
|
59
|
-
<h2>Welcome Section</h2>
|
|
60
|
-
<img src="decorative-border.png" alt="Beautiful decorative border image" width="100%" height="20" role="img" aria-label="Beautiful decorative border image">
|
|
61
|
-
<p>Welcome to our website</p>
|
|
62
|
-
</section>
|
|
63
|
-
|
|
64
|
-
<!-- Test Case 8: Functional icon without proper description -->
|
|
65
|
-
<section>
|
|
66
|
-
<h2>Contact Us</h2>
|
|
67
|
-
<button onclick="openChat()" role="button" aria-label="ボタン" title="ボタン">
|
|
68
|
-
<img src="chat-icon.svg" alt="Icon" width="20" height="20" role="img" aria-label="Icon">
|
|
69
|
-
</button>
|
|
70
|
-
</section>
|
|
71
|
-
|
|
72
|
-
<!-- Test Case 9: Complex image needing detailed description -->
|
|
73
|
-
<section>
|
|
74
|
-
<h2>System Architecture</h2>
|
|
75
|
-
<p>Our microservices architecture overview</p>
|
|
76
|
-
<img src="architecture-diagram.png" alt="Diagram" width="600" height="400" role="img" aria-label="Diagram">
|
|
77
|
-
</section>
|
|
78
|
-
|
|
79
|
-
<!-- Test Case 10: Image with filename in alt text -->
|
|
80
|
-
<section>
|
|
81
|
-
<h2>Product Features</h2>
|
|
82
|
-
<img src="feature-screenshot.png" alt="feature-screenshot.png showing app interface" width="300" height="200" role="img" aria-label="feature-screenshot.png showing app interface">
|
|
83
|
-
</section>
|
|
84
|
-
|
|
85
|
-
<!-- Test Case 11: Logo without "logo" in alt text -->
|
|
86
|
-
<section>
|
|
87
|
-
<h2>Partners</h2>
|
|
88
|
-
<img src="partner-logo.png" alt="Microsoft" width="150" height="75" role="img" aria-label="Microsoft">
|
|
89
|
-
</section>
|
|
90
|
-
|
|
91
|
-
<!-- Test Case 12: Chart with some data context -->
|
|
92
|
-
<section>
|
|
93
|
-
<h2>Growth Metrics</h2>
|
|
94
|
-
<p>User growth from 1000 to 5000 users, showing 400% increase</p>
|
|
95
|
-
<img src="growth-chart.png" alt="User growth statistics" width="400" height="250" role="img" aria-label="User growth statistics">
|
|
96
|
-
</section>
|
|
97
|
-
|
|
98
|
-
<!-- Test Case 13: Image in figure with figcaption -->
|
|
99
|
-
<figure>
|
|
100
|
-
<img src="research-data.jpg" alt="Gallery" width="350" height="200" role="img" aria-label="Gallery">
|
|
101
|
-
<figcaption>Research findings from our latest study on user behavior patterns</figcaption>
|
|
102
|
-
</figure>
|
|
103
|
-
|
|
104
|
-
<!-- Test Case 14: Multiple images with similar generic alt text -->
|
|
105
|
-
<section>
|
|
106
|
-
<h2>Gallery</h2>
|
|
107
|
-
<img src="photo1.jpg" alt="Photo" width="200" height="150" role="img" aria-label="Photo">
|
|
108
|
-
<img src="photo2.jpg" alt="Photo" width="200" height="150" role="img" aria-label="Photo">
|
|
109
|
-
<img src="photo3.jpg" alt="Photo" width="200" height="150" role="img" aria-label="Photo">
|
|
110
|
-
</section>
|
|
111
|
-
|
|
112
|
-
<!-- Test Case 15: Image with inconsistent alt and aria-label -->
|
|
113
|
-
<section>
|
|
114
|
-
<h2>Navigation</h2>
|
|
115
|
-
<img src="home-icon.png" alt="Home" aria-label="Go to homepage" width="32" height="32" role="img">
|
|
116
|
-
</section>
|
|
117
|
-
|
|
118
|
-
<!-- Test Case 16: Food image in restaurant context -->
|
|
119
|
-
<section>
|
|
120
|
-
<h2>Today's Special</h2>
|
|
121
|
-
<p>Delicious authentic Japanese cuisine</p>
|
|
122
|
-
<img src="sushi-plate.jpg" alt="Todays Special" width="300" height="200" role="img" aria-label="Todays Special">
|
|
123
|
-
</section>
|
|
124
|
-
|
|
125
|
-
<!-- Test Case 17: Technology device in business context -->
|
|
126
|
-
<section>
|
|
127
|
-
<h2>Enterprise Solutions</h2>
|
|
128
|
-
<p>Professional laptop for business productivity</p>
|
|
129
|
-
<img src="business-laptop.jpg" width="250" height="180" alt="Enterprise Solutions" role="img" aria-label="Enterprise Solutions">
|
|
130
|
-
</section>
|
|
131
|
-
|
|
132
|
-
<!-- Test Case 18: Nature image in lifestyle context -->
|
|
133
|
-
<section>
|
|
134
|
-
<h2>Wellness Program</h2>
|
|
135
|
-
<p>Find peace and tranquility in nature</p>
|
|
136
|
-
<img src="peaceful-forest.jpg" alt="Wellness Program" width="400" height="250" role="img" aria-label="Wellness Program">
|
|
137
|
-
</section>
|
|
138
|
-
</main>
|
|
139
|
-
|
|
140
|
-
<footer>
|
|
141
|
-
<p>Enhanced Alt Attribute Test Cases - GBU Accessibility Tool</p>
|
|
142
|
-
</footer>
|
|
143
|
-
|
|
144
|
-
<script>
|
|
145
|
-
function openChat() {
|
|
146
|
-
alert('Chat opened!');
|
|
147
|
-
}
|
|
148
|
-
</script>
|
|
149
|
-
</body>
|
|
150
|
-
</html>
|
|
@@ -1,87 +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>Form Labels Test - Accessibility Issues</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Form Labels Test Cases</h1>
|
|
10
|
-
|
|
11
|
-
<!-- Test Case 1: Input without any label -->
|
|
12
|
-
<div>
|
|
13
|
-
<input type="text" name="username" aria-label="Username" title="Username" id="username_input">
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<!-- Test Case 2: Input with empty label -->
|
|
17
|
-
<div>
|
|
18
|
-
<label for="email"></label>
|
|
19
|
-
<input type="email" id="email" name="email" aria-label="Email" title="Email">
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<!-- Test Case 3: Input without aria-label -->
|
|
23
|
-
<div>
|
|
24
|
-
<input type="password" name="password" placeholder="Enter password" aria-label="Enter password" title="Enter password" id="password_input">
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<!-- Test Case 4: Input with invalid aria-labelledby -->
|
|
28
|
-
<div>
|
|
29
|
-
<input type="tel" name="phone" aria-labelledby="nonexistent-id" aria-label="Phone" title="Phone" id="phone_input">
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<!-- Test Case 5: Input without title attribute -->
|
|
33
|
-
<div>
|
|
34
|
-
<input type="url" name="website" aria-label="Website" title="Website" id="website_input">
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<!-- Test Case 6: Textarea without proper labeling -->
|
|
38
|
-
<div>
|
|
39
|
-
<textarea name="comments" aria-label="Comments" title="Comments" id="comments_input"></textarea>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<!-- Test Case 7: Select without proper labeling -->
|
|
43
|
-
<div>
|
|
44
|
-
<select name="country" aria-label="Country" title="Country" id="country_input">
|
|
45
|
-
<option value="">Choose country</option>
|
|
46
|
-
<option value="jp">Japan</option>
|
|
47
|
-
<option value="us">USA</option>
|
|
48
|
-
</select>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<!-- Test Case 8: Input with implicit label but empty text -->
|
|
52
|
-
<div>
|
|
53
|
-
<label><input type="checkbox" name="agree"></label>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<!-- Test Case 9: Input with aria-labelledby pointing to empty element -->
|
|
57
|
-
<div>
|
|
58
|
-
<span id="empty-label"></span>
|
|
59
|
-
<input type="number" name="age" aria-labelledby="empty-label" aria-label="Age" title="Age" id="age_input">
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<!-- Test Case 10: Input without role override -->
|
|
63
|
-
<div>
|
|
64
|
-
<input type="range" name="volume" min="0" max="100" aria-label="Volume" title="Volume" id="volume_input">
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<!-- Test Case 11: Multiple inputs without proper structure -->
|
|
68
|
-
<form>
|
|
69
|
-
<input type="text" name="firstname" aria-label="Firstname" title="Firstname" id="firstname_input">
|
|
70
|
-
<input type="text" name="lastname" aria-label="Lastname" title="Lastname" id="lastname_input">
|
|
71
|
-
<input type="email" name="user_email" aria-label="User email" title="User email" id="user_email_input">
|
|
72
|
-
<textarea name="message" aria-label="Message" title="Message" id="message_input"></textarea>
|
|
73
|
-
<select name="priority" aria-label="Priority" title="Priority" id="priority_input">
|
|
74
|
-
<option value="low">Low</option>
|
|
75
|
-
<option value="high">High</option>
|
|
76
|
-
</select>
|
|
77
|
-
<input type="submit" value="Submit">
|
|
78
|
-
</form>
|
|
79
|
-
|
|
80
|
-
<!-- Test Case 12: Inputs with only placeholder (not sufficient) -->
|
|
81
|
-
<div>
|
|
82
|
-
<input type="search" name="query" placeholder="Search..." aria-label="Search..." title="Search..." id="query_input">
|
|
83
|
-
<input type="date" name="birthdate" placeholder="Select date" aria-label="Select date" title="Select date" id="birthdate_input">
|
|
84
|
-
<input type="time" name="appointment" placeholder="Select time" aria-label="Select time" title="Select time" id="appointment_input">
|
|
85
|
-
</div>
|
|
86
|
-
</body>
|
|
87
|
-
</html>
|
|
@@ -1,60 +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>Heading Structure Test - Accessibility Issues</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Heading Structure Test Cases</h1>
|
|
10
|
-
|
|
11
|
-
<!-- Test Case 1: Missing h1 (this will be converted from h2) -->
|
|
12
|
-
<h2>This should be h1</h2>
|
|
13
|
-
<p>Main content of the page</p>
|
|
14
|
-
|
|
15
|
-
<!-- Test Case 2: Multiple h1 elements -->
|
|
16
|
-
<h2>First h2 (should stay)</h2>
|
|
17
|
-
<h2>Second h2 (should become h2)</h2>
|
|
18
|
-
<h2>Third h2 (should become h2)</h2>
|
|
19
|
-
|
|
20
|
-
<!-- Test Case 3: Level skipping -->
|
|
21
|
-
<h2>Section heading</h2>
|
|
22
|
-
<h3>Subsection (skips h3 - should become h3)</h3>
|
|
23
|
-
<h4>Sub-subsection (skips h4, h4 - should become h4)</h4>
|
|
24
|
-
|
|
25
|
-
<!-- Test Case 4: Empty headings -->
|
|
26
|
-
<h3>Details should Service</h3>
|
|
27
|
-
<h4>dings with context</h4>
|
|
28
|
-
<h5>Subsection skips should</h5>
|
|
29
|
-
|
|
30
|
-
<!-- Test Case 5: Duplicate headings -->
|
|
31
|
-
<h2>Products (2)</h2>
|
|
32
|
-
<p>Some content about products</p>
|
|
33
|
-
<h2>Products</h2>
|
|
34
|
-
<p>More content about products</p>
|
|
35
|
-
|
|
36
|
-
<!-- Test Case 6: Proper structure (should not be changed) -->
|
|
37
|
-
<h2>Proper Section</h2>
|
|
38
|
-
<h3>Proper Subsection</h3>
|
|
39
|
-
<h4>Proper Sub-subsection</h4>
|
|
40
|
-
<p>Content with proper heading hierarchy</p>
|
|
41
|
-
|
|
42
|
-
<!-- Test Case 7: Complex nesting with issues -->
|
|
43
|
-
<h2>Services</h2>
|
|
44
|
-
<h3>Service 1 (should be h3)</h3>
|
|
45
|
-
<h4>Details (should be h4)</h4>
|
|
46
|
-
<h3>Service 2 (correct)</h3>
|
|
47
|
-
<h4>More details (should be h4)</h4>
|
|
48
|
-
|
|
49
|
-
<!-- Test Case 8: Empty headings with context -->
|
|
50
|
-
<div class="section">
|
|
51
|
-
<h3>Section heading Subsection</h3>
|
|
52
|
-
<p>This section talks about our company history and achievements.</p>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class="product-info">
|
|
56
|
-
<h4>ection heading Subsection</h4>
|
|
57
|
-
<p>Our flagship product offers innovative solutions for modern businesses.</p>
|
|
58
|
-
</div>
|
|
59
|
-
</body>
|
|
60
|
-
</html>
|
|
@@ -1,60 +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>Heading Structure Test - Accessibility Issues</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Heading Structure Test Cases</h1>
|
|
10
|
-
|
|
11
|
-
<!-- Test Case 1: Missing h1 (this will be converted from h2) -->
|
|
12
|
-
<h2>This should be h1</h2>
|
|
13
|
-
<p>Main content of the page</p>
|
|
14
|
-
|
|
15
|
-
<!-- Test Case 2: Multiple h1 elements -->
|
|
16
|
-
<h1>First h1 (should stay)</h1>
|
|
17
|
-
<h1>Second h1 (should become h2)</h1>
|
|
18
|
-
<h1>Third h1 (should become h2)</h1>
|
|
19
|
-
|
|
20
|
-
<!-- Test Case 3: Level skipping -->
|
|
21
|
-
<h2>Section heading</h2>
|
|
22
|
-
<h4>Subsection (skips h3 - should become h3)</h4>
|
|
23
|
-
<h6>Sub-subsection (skips h4, h5 - should become h4)</h6>
|
|
24
|
-
|
|
25
|
-
<!-- Test Case 4: Empty headings -->
|
|
26
|
-
<h3></h3>
|
|
27
|
-
<h4> </h4>
|
|
28
|
-
<h5><span></span></h5>
|
|
29
|
-
|
|
30
|
-
<!-- Test Case 5: Duplicate headings -->
|
|
31
|
-
<h2>Products</h2>
|
|
32
|
-
<p>Some content about products</p>
|
|
33
|
-
<h2>Products</h2>
|
|
34
|
-
<p>More content about products</p>
|
|
35
|
-
|
|
36
|
-
<!-- Test Case 6: Proper structure (should not be changed) -->
|
|
37
|
-
<h2>Proper Section</h2>
|
|
38
|
-
<h3>Proper Subsection</h3>
|
|
39
|
-
<h4>Proper Sub-subsection</h4>
|
|
40
|
-
<p>Content with proper heading hierarchy</p>
|
|
41
|
-
|
|
42
|
-
<!-- Test Case 7: Complex nesting with issues -->
|
|
43
|
-
<h2>Services</h2>
|
|
44
|
-
<h5>Service 1 (should be h3)</h5>
|
|
45
|
-
<h6>Details (should be h4)</h6>
|
|
46
|
-
<h3>Service 2 (correct)</h3>
|
|
47
|
-
<h5>More details (should be h4)</h5>
|
|
48
|
-
|
|
49
|
-
<!-- Test Case 8: Empty headings with context -->
|
|
50
|
-
<div class="section">
|
|
51
|
-
<h3></h3>
|
|
52
|
-
<p>This section talks about our company history and achievements.</p>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class="product-info">
|
|
56
|
-
<h4> </h4>
|
|
57
|
-
<p>Our flagship product offers innovative solutions for modern businesses.</p>
|
|
58
|
-
</div>
|
|
59
|
-
</body>
|
|
60
|
-
</html>
|