gbu-accessibility-package 3.5.0 → 3.8.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 +50 -0
- package/README-vi.md +51 -7
- package/README.md +50 -7
- package/cli.js +97 -5
- package/demo/1mb-jpg-example-file.jpg +0 -0
- package/demo/advanced-test.html +13 -13
- package/demo/aria-label-test.html +2 -2
- package/demo/broken-links-test.html +10 -10
- package/demo/comprehensive-test.html +4 -4
- package/demo/dead-code-test.css +68 -0
- package/demo/dead-code-test.html +36 -0
- package/demo/dead-code-test.js +77 -0
- package/demo/duplicate-roles.html +15 -15
- package/demo/enhanced-alt-test.html +22 -22
- package/demo/form-labels-test.html +17 -17
- package/demo/heading-structure-test.html +14 -14
- package/demo/heading-structure-test.html.backup +60 -0
- package/demo/large-file-demo.css +213 -0
- package/demo/nested-controls-test.html +17 -17
- package/demo/sample.html +12 -12
- package/demo/test-external-links.html +26 -0
- package/demo/unused-files-test.html +31 -0
- package/demo/unused-image.png +1 -0
- package/demo/unused-page.html +11 -0
- package/demo/unused-script.js +12 -0
- package/demo/unused-style.css +10 -0
- package/demo/very-large-file.js +2 -0
- package/lib/fixer.js +1438 -97
- package/package.json +15 -2
|
@@ -0,0 +1,77 @@
|
|
|
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();
|
|
@@ -7,29 +7,29 @@
|
|
|
7
7
|
<h1>Test Duplicate Role Attributes</h1>
|
|
8
8
|
|
|
9
9
|
<!-- Images with duplicate roles -->
|
|
10
|
-
<img src="logo.png" alt="Logo" role="img"
|
|
11
|
-
<img src="banner.jpg" alt="Banner" role="img"
|
|
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
12
|
|
|
13
13
|
<!-- Links with duplicate roles -->
|
|
14
|
-
<a href="/home" role="link"
|
|
15
|
-
<a href="/about" role="link"
|
|
14
|
+
<a href="/home" role="link">Home</a>
|
|
15
|
+
<a href="/about" role="link">About</a>
|
|
16
16
|
|
|
17
17
|
<!-- Buttons with duplicate roles -->
|
|
18
|
-
<button onclick="submit()" role="button"
|
|
19
|
-
<button type="button" role="button"
|
|
18
|
+
<button onclick="submit()" role="button">Submit</button>
|
|
19
|
+
<button type="button" role="button">Click Me</button>
|
|
20
20
|
|
|
21
21
|
<!-- Mixed quotes -->
|
|
22
|
-
<div onclick="toggle()" role="button"
|
|
23
|
-
<span onclick="show()" role='button'
|
|
22
|
+
<div onclick="toggle()" role="button">Toggle</div>
|
|
23
|
+
<span onclick="show()" role='button'>Show</span>
|
|
24
24
|
|
|
25
25
|
<!-- Navigation with duplicates -->
|
|
26
26
|
<nav>
|
|
27
|
-
<ul class="nav-menu" role="menubar"
|
|
28
|
-
<li class="nav-item" role="menuitem"
|
|
29
|
-
<a href="/products" role="link"
|
|
27
|
+
<ul class="nav-menu" role="menubar">
|
|
28
|
+
<li class="nav-item" role="menuitem">
|
|
29
|
+
<a href="/products" role="link">Products</a>
|
|
30
30
|
</li>
|
|
31
|
-
<li class="nav-item" role="menuitem"
|
|
32
|
-
<a href="/services" role="link"
|
|
31
|
+
<li class="nav-item" role="menuitem">
|
|
32
|
+
<a href="/services" role="link">Services</a>
|
|
33
33
|
</li>
|
|
34
34
|
</ul>
|
|
35
35
|
</nav>
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
<!-- Complex duplicates -->
|
|
38
38
|
<article>
|
|
39
39
|
<h2>Article with Issues</h2>
|
|
40
|
-
<img src="article1.jpg" alt="Article Image" role="img"
|
|
40
|
+
<img src="article1.jpg" alt="Article Image" role="img" aria-label="Article Image">
|
|
41
41
|
<p>Some content...</p>
|
|
42
|
-
<a href="/read-more" role="link"
|
|
42
|
+
<a href="/read-more" role="link">Read More</a>
|
|
43
43
|
</article>
|
|
44
44
|
</body>
|
|
45
45
|
</html>
|
|
@@ -16,34 +16,34 @@
|
|
|
16
16
|
<section>
|
|
17
17
|
<h2>Company Logo</h2>
|
|
18
18
|
<p>Welcome to our innovative technology company</p>
|
|
19
|
-
<img src="company-logo.png" width="200" height="100">
|
|
19
|
+
<img src="company-logo.png" width="200" height="100" alt="Company Logo" role="img" aria-label="Company Logo">
|
|
20
20
|
</section>
|
|
21
21
|
|
|
22
22
|
<!-- Test Case 2: Empty alt attribute for content image -->
|
|
23
23
|
<section>
|
|
24
24
|
<h2>Product Showcase</h2>
|
|
25
25
|
<p>Our latest smartphone with advanced features</p>
|
|
26
|
-
<img src="smartphone-product.jpg" alt="" width="300" height="200">
|
|
26
|
+
<img src="smartphone-product.jpg" alt="Product Showcase" width="300" height="200" role="img" aria-label="Product Showcase">
|
|
27
27
|
</section>
|
|
28
28
|
|
|
29
29
|
<!-- Test Case 3: Alt text too long -->
|
|
30
30
|
<section>
|
|
31
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">
|
|
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
33
|
</section>
|
|
34
34
|
|
|
35
35
|
<!-- Test Case 4: Alt text with redundant words -->
|
|
36
36
|
<section>
|
|
37
37
|
<h2>Office Environment</h2>
|
|
38
|
-
<img src="office.jpg" alt="Image of office picture showing workplace photo" width="350" height="250">
|
|
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
39
|
</section>
|
|
40
40
|
|
|
41
41
|
<!-- Test Case 5: Generic alt text -->
|
|
42
42
|
<section>
|
|
43
43
|
<h2>Learn More</h2>
|
|
44
44
|
<p>Discover our services</p>
|
|
45
|
-
<a href="/services">
|
|
46
|
-
<img src="arrow-right.png" alt="Click here" width="24" height="24">
|
|
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
47
|
</a>
|
|
48
48
|
</section>
|
|
49
49
|
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
<section>
|
|
52
52
|
<h2>Sales Performance</h2>
|
|
53
53
|
<p>Our sales increased by 25% this quarter</p>
|
|
54
|
-
<img src="sales-chart.png" alt="Chart" width="500" height="300">
|
|
54
|
+
<img src="sales-chart.png" alt="Chart" width="500" height="300" role="img" aria-label="Chart">
|
|
55
55
|
</section>
|
|
56
56
|
|
|
57
57
|
<!-- Test Case 7: Decorative image with content alt -->
|
|
58
58
|
<section>
|
|
59
59
|
<h2>Welcome Section</h2>
|
|
60
|
-
<img src="decorative-border.png" alt="Beautiful decorative border image" width="100%" height="20">
|
|
60
|
+
<img src="decorative-border.png" alt="Beautiful decorative border image" width="100%" height="20" role="img" aria-label="Beautiful decorative border image">
|
|
61
61
|
<p>Welcome to our website</p>
|
|
62
62
|
</section>
|
|
63
63
|
|
|
64
64
|
<!-- Test Case 8: Functional icon without proper description -->
|
|
65
65
|
<section>
|
|
66
66
|
<h2>Contact Us</h2>
|
|
67
|
-
<button onclick="openChat()">
|
|
68
|
-
<img src="chat-icon.svg" alt="Icon" width="20" height="20">
|
|
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
69
|
</button>
|
|
70
70
|
</section>
|
|
71
71
|
|
|
@@ -73,67 +73,67 @@
|
|
|
73
73
|
<section>
|
|
74
74
|
<h2>System Architecture</h2>
|
|
75
75
|
<p>Our microservices architecture overview</p>
|
|
76
|
-
<img src="architecture-diagram.png" alt="Diagram" width="600" height="400">
|
|
76
|
+
<img src="architecture-diagram.png" alt="Diagram" width="600" height="400" role="img" aria-label="Diagram">
|
|
77
77
|
</section>
|
|
78
78
|
|
|
79
79
|
<!-- Test Case 10: Image with filename in alt text -->
|
|
80
80
|
<section>
|
|
81
81
|
<h2>Product Features</h2>
|
|
82
|
-
<img src="feature-screenshot.png" alt="feature-screenshot.png showing app interface" width="300" height="200">
|
|
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
83
|
</section>
|
|
84
84
|
|
|
85
85
|
<!-- Test Case 11: Logo without "logo" in alt text -->
|
|
86
86
|
<section>
|
|
87
87
|
<h2>Partners</h2>
|
|
88
|
-
<img src="partner-logo.png" alt="Microsoft" width="150" height="75">
|
|
88
|
+
<img src="partner-logo.png" alt="Microsoft" width="150" height="75" role="img" aria-label="Microsoft">
|
|
89
89
|
</section>
|
|
90
90
|
|
|
91
91
|
<!-- Test Case 12: Chart with some data context -->
|
|
92
92
|
<section>
|
|
93
93
|
<h2>Growth Metrics</h2>
|
|
94
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">
|
|
95
|
+
<img src="growth-chart.png" alt="User growth statistics" width="400" height="250" role="img" aria-label="User growth statistics">
|
|
96
96
|
</section>
|
|
97
97
|
|
|
98
98
|
<!-- Test Case 13: Image in figure with figcaption -->
|
|
99
99
|
<figure>
|
|
100
|
-
<img src="research-data.jpg" alt="" width="350" height="200">
|
|
100
|
+
<img src="research-data.jpg" alt="Gallery" width="350" height="200" role="img" aria-label="Gallery">
|
|
101
101
|
<figcaption>Research findings from our latest study on user behavior patterns</figcaption>
|
|
102
102
|
</figure>
|
|
103
103
|
|
|
104
104
|
<!-- Test Case 14: Multiple images with similar generic alt text -->
|
|
105
105
|
<section>
|
|
106
106
|
<h2>Gallery</h2>
|
|
107
|
-
<img src="photo1.jpg" alt="Photo" width="200" height="150">
|
|
108
|
-
<img src="photo2.jpg" alt="Photo" width="200" height="150">
|
|
109
|
-
<img src="photo3.jpg" alt="Photo" width="200" height="150">
|
|
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
110
|
</section>
|
|
111
111
|
|
|
112
112
|
<!-- Test Case 15: Image with inconsistent alt and aria-label -->
|
|
113
113
|
<section>
|
|
114
114
|
<h2>Navigation</h2>
|
|
115
|
-
<img src="home-icon.png" alt="Home" aria-label="Go to homepage" width="32" height="32">
|
|
115
|
+
<img src="home-icon.png" alt="Home" aria-label="Go to homepage" width="32" height="32" role="img">
|
|
116
116
|
</section>
|
|
117
117
|
|
|
118
118
|
<!-- Test Case 16: Food image in restaurant context -->
|
|
119
119
|
<section>
|
|
120
120
|
<h2>Today's Special</h2>
|
|
121
121
|
<p>Delicious authentic Japanese cuisine</p>
|
|
122
|
-
<img src="sushi-plate.jpg" alt="" width="300" height="200">
|
|
122
|
+
<img src="sushi-plate.jpg" alt="Todays Special" width="300" height="200" role="img" aria-label="Todays Special">
|
|
123
123
|
</section>
|
|
124
124
|
|
|
125
125
|
<!-- Test Case 17: Technology device in business context -->
|
|
126
126
|
<section>
|
|
127
127
|
<h2>Enterprise Solutions</h2>
|
|
128
128
|
<p>Professional laptop for business productivity</p>
|
|
129
|
-
<img src="business-laptop.jpg" width="250" height="180">
|
|
129
|
+
<img src="business-laptop.jpg" width="250" height="180" alt="Enterprise Solutions" role="img" aria-label="Enterprise Solutions">
|
|
130
130
|
</section>
|
|
131
131
|
|
|
132
132
|
<!-- Test Case 18: Nature image in lifestyle context -->
|
|
133
133
|
<section>
|
|
134
134
|
<h2>Wellness Program</h2>
|
|
135
135
|
<p>Find peace and tranquility in nature</p>
|
|
136
|
-
<img src="peaceful-forest.jpg" alt="" width="400" height="250">
|
|
136
|
+
<img src="peaceful-forest.jpg" alt="Wellness Program" width="400" height="250" role="img" aria-label="Wellness Program">
|
|
137
137
|
</section>
|
|
138
138
|
</main>
|
|
139
139
|
|
|
@@ -10,38 +10,38 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- Test Case 1: Input without any label -->
|
|
12
12
|
<div>
|
|
13
|
-
<input type="text" name="username">
|
|
13
|
+
<input type="text" name="username" aria-label="Username" title="Username" id="username_input">
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<!-- Test Case 2: Input with empty label -->
|
|
17
17
|
<div>
|
|
18
18
|
<label for="email"></label>
|
|
19
|
-
<input type="email" id="email" name="email">
|
|
19
|
+
<input type="email" id="email" name="email" aria-label="Email" title="Email">
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
22
|
<!-- Test Case 3: Input without aria-label -->
|
|
23
23
|
<div>
|
|
24
|
-
<input type="password" name="password" placeholder="Enter password">
|
|
24
|
+
<input type="password" name="password" placeholder="Enter password" aria-label="Enter password" title="Enter password" id="password_input">
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<!-- Test Case 4: Input with invalid aria-labelledby -->
|
|
28
28
|
<div>
|
|
29
|
-
<input type="tel" name="phone" aria-labelledby="nonexistent-id">
|
|
29
|
+
<input type="tel" name="phone" aria-labelledby="nonexistent-id" aria-label="Phone" title="Phone" id="phone_input">
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
<!-- Test Case 5: Input without title attribute -->
|
|
33
33
|
<div>
|
|
34
|
-
<input type="url" name="website">
|
|
34
|
+
<input type="url" name="website" aria-label="Website" title="Website" id="website_input">
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
37
|
<!-- Test Case 6: Textarea without proper labeling -->
|
|
38
38
|
<div>
|
|
39
|
-
<textarea name="comments"></textarea>
|
|
39
|
+
<textarea name="comments" aria-label="Comments" title="Comments" id="comments_input"></textarea>
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
42
|
<!-- Test Case 7: Select without proper labeling -->
|
|
43
43
|
<div>
|
|
44
|
-
<select name="country">
|
|
44
|
+
<select name="country" aria-label="Country" title="Country" id="country_input">
|
|
45
45
|
<option value="">Choose country</option>
|
|
46
46
|
<option value="jp">Japan</option>
|
|
47
47
|
<option value="us">USA</option>
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
<!-- Test Case 9: Input with aria-labelledby pointing to empty element -->
|
|
57
57
|
<div>
|
|
58
58
|
<span id="empty-label"></span>
|
|
59
|
-
<input type="number" name="age" aria-labelledby="empty-label">
|
|
59
|
+
<input type="number" name="age" aria-labelledby="empty-label" aria-label="Age" title="Age" id="age_input">
|
|
60
60
|
</div>
|
|
61
61
|
|
|
62
62
|
<!-- Test Case 10: Input without role override -->
|
|
63
63
|
<div>
|
|
64
|
-
<input type="range" name="volume" min="0" max="100">
|
|
64
|
+
<input type="range" name="volume" min="0" max="100" aria-label="Volume" title="Volume" id="volume_input">
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
67
|
<!-- Test Case 11: Multiple inputs without proper structure -->
|
|
68
68
|
<form>
|
|
69
|
-
<input type="text" name="firstname">
|
|
70
|
-
<input type="text" name="lastname">
|
|
71
|
-
<input type="email" name="user_email">
|
|
72
|
-
<textarea name="message"></textarea>
|
|
73
|
-
<select name="priority">
|
|
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
74
|
<option value="low">Low</option>
|
|
75
75
|
<option value="high">High</option>
|
|
76
76
|
</select>
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
|
|
80
80
|
<!-- Test Case 12: Inputs with only placeholder (not sufficient) -->
|
|
81
81
|
<div>
|
|
82
|
-
<input type="search" name="query" placeholder="Search...">
|
|
83
|
-
<input type="date" name="birthdate" placeholder="Select date">
|
|
84
|
-
<input type="time" name="appointment" placeholder="Select time">
|
|
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
85
|
</div>
|
|
86
86
|
</body>
|
|
87
87
|
</html>
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
<p>Main content of the page</p>
|
|
14
14
|
|
|
15
15
|
<!-- Test Case 2: Multiple h1 elements -->
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
16
|
+
<h2>First h2 (should stay)</h2>
|
|
17
|
+
<h2>Second h2 (should become h2)</h2>
|
|
18
|
+
<h2>Third h2 (should become h2)</h2>
|
|
19
19
|
|
|
20
20
|
<!-- Test Case 3: Level skipping -->
|
|
21
21
|
<h2>Section heading</h2>
|
|
22
|
-
<
|
|
23
|
-
<
|
|
22
|
+
<h3>Subsection (skips h3 - should become h3)</h3>
|
|
23
|
+
<h4>Sub-subsection (skips h4, h4 - should become h4)</h4>
|
|
24
24
|
|
|
25
25
|
<!-- Test Case 4: Empty headings -->
|
|
26
|
-
<h3
|
|
27
|
-
<h4>
|
|
28
|
-
<h5
|
|
26
|
+
<h3>Details should Service</h3>
|
|
27
|
+
<h4>dings with context</h4>
|
|
28
|
+
<h5>Subsection skips should</h5>
|
|
29
29
|
|
|
30
30
|
<!-- Test Case 5: Duplicate headings -->
|
|
31
|
-
<h2>Products</h2>
|
|
31
|
+
<h2>Products (2)</h2>
|
|
32
32
|
<p>Some content about products</p>
|
|
33
33
|
<h2>Products</h2>
|
|
34
34
|
<p>More content about products</p>
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
|
|
42
42
|
<!-- Test Case 7: Complex nesting with issues -->
|
|
43
43
|
<h2>Services</h2>
|
|
44
|
-
<
|
|
45
|
-
<
|
|
44
|
+
<h3>Service 1 (should be h3)</h3>
|
|
45
|
+
<h4>Details (should be h4)</h4>
|
|
46
46
|
<h3>Service 2 (correct)</h3>
|
|
47
|
-
<
|
|
47
|
+
<h4>More details (should be h4)</h4>
|
|
48
48
|
|
|
49
49
|
<!-- Test Case 8: Empty headings with context -->
|
|
50
50
|
<div class="section">
|
|
51
|
-
<h3
|
|
51
|
+
<h3>Section heading Subsection</h3>
|
|
52
52
|
<p>This section talks about our company history and achievements.</p>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
55
|
<div class="product-info">
|
|
56
|
-
<h4>
|
|
56
|
+
<h4>ection heading Subsection</h4>
|
|
57
57
|
<p>Our flagship product offers innovative solutions for modern businesses.</p>
|
|
58
58
|
</div>
|
|
59
59
|
</body>
|
|
@@ -0,0 +1,60 @@
|
|
|
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>
|