testilo 41.2.1 → 41.4.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/package.json +1 -1
- package/procs/digest/tdp48/index.html +125 -0
- package/procs/digest/tdp48/index.js +240 -0
- package/procs/digest/tdp49/index.html +161 -0
- package/procs/digest/tdp49/index.js +240 -0
- package/procs/score/tic45.js +22 -22
package/package.json
CHANGED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html lang="en-US">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="author" content="Testilo">
|
|
7
|
+
<meta name="creator" content="Testilo">
|
|
8
|
+
<meta name="publisher" name="Testilo">
|
|
9
|
+
<meta name="description" content="report of accessibility testing of a web page">
|
|
10
|
+
<meta name="keywords" content="accessibility a11y web testing">
|
|
11
|
+
<title>Accessibility digest</title>
|
|
12
|
+
<link rel="icon" href="favicon.ico">
|
|
13
|
+
<link rel="stylesheet" href="style.css">
|
|
14
|
+
<script id="script" type="module">
|
|
15
|
+
const sortButton = document.getElementById('sortButton');
|
|
16
|
+
const sortChangeSpan = document.getElementById('sortChange');
|
|
17
|
+
const sumBody = document.getElementById('sumBody');
|
|
18
|
+
const rows = Array.from(sumBody.children);
|
|
19
|
+
const sortRowsBy = basis => {
|
|
20
|
+
if (basis === 'wcag') {
|
|
21
|
+
rows.sort((a, b) => {
|
|
22
|
+
const sorters = [a, b].map(row => {
|
|
23
|
+
const wcagParts = row.children[1].textContent.split('.');
|
|
24
|
+
const wcagNums = wcagParts.map(part => Number.parseInt(part, 10));
|
|
25
|
+
return 100 * (wcagNums[0] || 0) + 20 * (wcagNums[1] || 0) + (wcagNums[2] || 0);
|
|
26
|
+
});
|
|
27
|
+
return sorters[0] - sorters[1];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else if (basis === 'score') {
|
|
31
|
+
rows.sort((a, b) => {
|
|
32
|
+
const sorters = [a, b].map(row => Number.parseInt(row.children[3].textContent));
|
|
33
|
+
return sorters[1] - sorters[0];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
sumBody.textContent = '';
|
|
37
|
+
rows.forEach(row => {
|
|
38
|
+
sumBody.appendChild(row);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
sortButton.addEventListener('click', event => {
|
|
42
|
+
// Add the new sorting basis to the page.
|
|
43
|
+
sortChangeSpan.textContent = sortChangeSpan.textContent === 'score to WCAG'
|
|
44
|
+
? 'WCAG to score'
|
|
45
|
+
: 'score to WCAG';
|
|
46
|
+
const newBasis = sortChangeSpan.textContent === 'score to WCAG' ? 'score' : 'wcag';
|
|
47
|
+
// Re-sort the table.
|
|
48
|
+
sortRowsBy(newBasis);
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
</head>
|
|
52
|
+
<body>
|
|
53
|
+
<main>
|
|
54
|
+
<header>
|
|
55
|
+
<h1>Accessibility digest</h1>
|
|
56
|
+
<h2>Contents</h2>
|
|
57
|
+
<ul>
|
|
58
|
+
<li><a href="#intro">Introduction</a></li>
|
|
59
|
+
<li><a href="#summary">Issue summary</a></li>
|
|
60
|
+
<li><a href="#itemization">Itemized issues</a></li>
|
|
61
|
+
<li><a href="#elements">Elements with issues</a></li>
|
|
62
|
+
</ul>
|
|
63
|
+
<table class="allBorder">
|
|
64
|
+
<caption>Synopsis</caption>
|
|
65
|
+
<tr><th>Page</th><td>__org__</td></tr>
|
|
66
|
+
<tr><th>URL</th><td>__url__</td></tr>
|
|
67
|
+
<tr><th>Test date</th><td>__dateSlash__</td></tr>
|
|
68
|
+
<tr><th>Score</th><td>__total__</td></tr>
|
|
69
|
+
</table>
|
|
70
|
+
<table class="allBorder">
|
|
71
|
+
<caption>Configuration</caption>
|
|
72
|
+
<tr><th>Redirections</th><td>__redirections__</td></tr>
|
|
73
|
+
<tr><th>Tool isolation</th><td>__isolation__</td></tr>
|
|
74
|
+
<tr><th>Report format(s)</th><td>__standard__</td></tr>
|
|
75
|
+
<tr><th>Requester</th><td>__requester__</td></tr>
|
|
76
|
+
<tr><th>Device</th><td>__device__</td></tr>
|
|
77
|
+
<tr><th>Browser type</th><td>__browser__</td></tr>
|
|
78
|
+
<tr><th>Reduced motion</th><td>__motion__</td></tr>
|
|
79
|
+
<tr><th>Tested by</th><td>Testaro__agent__, procedure <code>__ts__</code></td></tr>
|
|
80
|
+
<tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
|
|
81
|
+
<tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Full report</th>
|
|
84
|
+
<td><a href="__reportURL__"><code>__reportURL__</code></a></td>
|
|
85
|
+
</tr>
|
|
86
|
+
</table>
|
|
87
|
+
</header>
|
|
88
|
+
<h2 id="intro">Introduction</h2>
|
|
89
|
+
<p>How <a href="https://www.w3.org/WAI/">accessible</a> is the __org__ web page at <a href="__url__"><code>__url__</code></a>?</p>
|
|
90
|
+
<p>This digest can help answer that question. Ten different tools (Alfa, ASLint, Axe, Editoria11y, Equal Access, HTML CodeSniffer, Nu Html Checker, QualWeb, Testaro, and WAVE) tested the page to check its compliance with their accessibility rules. In all, the tools define about 990 rules, which are classified here into about 310 accessibility issues.</p>
|
|
91
|
+
<p>The results were interpreted to yield a score, with 0 being ideal. The score for this page was __total__, the sum of __issueCount__ for the count of issues, __issue__ for specific issues, __solo__ for unclassified rule violations, __tool__ for tool-by-tool ratings, __element__ for the count of violating elements, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
|
|
92
|
+
<h2 id="summary">Issue summary</h2>
|
|
93
|
+
<h3>Details about this summary</h3>
|
|
94
|
+
<ul>
|
|
95
|
+
<li>This table shows the numbers of rule violations (<q>instances</q>) reported by one or more tools, classified by issue.</li>
|
|
96
|
+
<li>Tools often disagree on instance counts, because of non-equivalent rules or invalid tests. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</li>
|
|
97
|
+
<li>The <q>WCAG</q> value is the principle, guideline, or success criterion of the <a href="https://www.w3.org/TR/WCAG22/">Web Content Accessibility Guidelines</a> most relevant to the issue.</li>
|
|
98
|
+
<li>The <q>Score</q> value is the contribution of the issue to the page score.</li>
|
|
99
|
+
<li>An instance count of 0 means the tool has a rule belonging to the issue but reported no violations of that rule, although at least one tool reported at least one violation.</li>
|
|
100
|
+
<li>You can sort this table by WCAG or score.</li>
|
|
101
|
+
</ul>
|
|
102
|
+
<h3>The summary</h3>
|
|
103
|
+
<p>This table summarizes the issues reported. Each issue has a <dfn>weight</dfn>, ranging from 1 (minor or advisory) to 4 (serious).</p>
|
|
104
|
+
<p><button id="sortButton" type="button">Change sorting from <span id="sortChange">score to WCAG</span></button></p>
|
|
105
|
+
<table class="allBorder thirdCellRight">
|
|
106
|
+
<caption>How many violations each tool reported, by issue</caption>
|
|
107
|
+
<thead>
|
|
108
|
+
<tr><th>Issue</th><th>WCAG</th><th>Weight</th><th>Score</th><th>Instance counts</th></tr>
|
|
109
|
+
</thead>
|
|
110
|
+
<tbody id="sumBody" class="headersLeft">
|
|
111
|
+
__issueRows__
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>
|
|
114
|
+
<h2 id="itemization">Itemized issues</h2>
|
|
115
|
+
<p>The reported rule violations are itemized below, issue by issue. Additional details can be inspected in the <a href="__reportURL__">full report</a>.</p>
|
|
116
|
+
__issueDetailRows__
|
|
117
|
+
<h2 id="elements">Elements with issues</h2>
|
|
118
|
+
<p>Elements exhibiting issues:</p>
|
|
119
|
+
__elementRows__
|
|
120
|
+
<footer>
|
|
121
|
+
<p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
|
|
122
|
+
</footer>
|
|
123
|
+
</main>
|
|
124
|
+
</body>
|
|
125
|
+
</html>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
© 2024 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// index: digester for scoring procedure tsp43.
|
|
24
|
+
|
|
25
|
+
// IMPORTS
|
|
26
|
+
|
|
27
|
+
// Module to keep secrets.
|
|
28
|
+
require('dotenv').config();
|
|
29
|
+
// Module to classify tool rules into issues
|
|
30
|
+
const {issues} = require('../../score/tic45');
|
|
31
|
+
// Module to process files.
|
|
32
|
+
const fs = require('fs/promises');
|
|
33
|
+
// Utility module.
|
|
34
|
+
const {getNowDate, getNowDateSlash} = require('../../util');
|
|
35
|
+
|
|
36
|
+
// CONSTANTS
|
|
37
|
+
|
|
38
|
+
// Digester ID.
|
|
39
|
+
const digesterID = 'tdp48';
|
|
40
|
+
// Newline with indentations.
|
|
41
|
+
const innerJoiner = '\n ';
|
|
42
|
+
const outerJoiner = '\n ';
|
|
43
|
+
// Directory of WCAG links.
|
|
44
|
+
const wcagPhrases = {};
|
|
45
|
+
|
|
46
|
+
// FUNCTIONS
|
|
47
|
+
|
|
48
|
+
// Gets a row of the score-summary table.
|
|
49
|
+
const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
|
|
50
|
+
// Gets a WCAG link or, if not obtainable, a numeric identifier.
|
|
51
|
+
const getWCAGTerm = wcag => {
|
|
52
|
+
const wcagPhrase = wcagPhrases[wcag];
|
|
53
|
+
const wcagTerm = wcagPhrase
|
|
54
|
+
? `<a href="https://www.w3.org/WAI/WCAG22/Understanding/${wcagPhrase}.html">${wcag}</a>`
|
|
55
|
+
: wcag;
|
|
56
|
+
return wcagTerm;
|
|
57
|
+
};
|
|
58
|
+
// Gets a row of the issue-score-summary table.
|
|
59
|
+
const getIssueScoreRow = (issueConstants, issueDetails) => {
|
|
60
|
+
const {summary, wcag, weight} = issueConstants;
|
|
61
|
+
const wcagTerm = getWCAGTerm(wcag);
|
|
62
|
+
const {instanceCounts, score} = issueDetails;
|
|
63
|
+
const toolList = Object
|
|
64
|
+
.keys(instanceCounts)
|
|
65
|
+
.map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
|
|
66
|
+
.join(', ');
|
|
67
|
+
return `<tr><th>${summary}</th><td class="center">${wcagTerm}<td class="right num">${weight}</td><td class="right num">${score}</td><td>${toolList}</td></tr>`;
|
|
68
|
+
};
|
|
69
|
+
// Populates the directory of WCAG understanding verbal IDs.
|
|
70
|
+
const getWCAGPhrases = async () => {
|
|
71
|
+
// Get the copy of file https://raw.githubusercontent.com/w3c/wcag/main/guidelines/wcag.json.
|
|
72
|
+
const wcagJSON = await fs.readFile(`${__dirname}/../../../wcag.json`, 'utf8');
|
|
73
|
+
const wcag = JSON.parse(wcagJSON);
|
|
74
|
+
const {principles} = wcag;
|
|
75
|
+
// For each principle in it:
|
|
76
|
+
principles.forEach(principle => {
|
|
77
|
+
// If it is usable:
|
|
78
|
+
if (principle.num && principle.id && principle.id.startsWith('WCAG2:')) {
|
|
79
|
+
// Add it to the directory.
|
|
80
|
+
wcagPhrases[principle.num] = principle.id.slice(6);
|
|
81
|
+
const {guidelines} = principle;
|
|
82
|
+
// For each guideline in the principle:
|
|
83
|
+
guidelines.forEach(guideline => {
|
|
84
|
+
// If it is usable:
|
|
85
|
+
if (guideline.num && guideline.id && guideline.id.startsWith('WCAG2:')) {
|
|
86
|
+
// Add it to the directory.
|
|
87
|
+
wcagPhrases[guideline.num] = guideline.id.slice(6);
|
|
88
|
+
const {successcriteria} = guideline;
|
|
89
|
+
// For each success criterion in the guideline:
|
|
90
|
+
successcriteria.forEach(successCriterion => {
|
|
91
|
+
// If it is usable:
|
|
92
|
+
if (
|
|
93
|
+
successCriterion.num
|
|
94
|
+
&& successCriterion.id
|
|
95
|
+
&& successCriterion.id.startsWith('WCAG2:')
|
|
96
|
+
) {
|
|
97
|
+
// Add it to the directory.
|
|
98
|
+
wcagPhrases[successCriterion.num] = successCriterion.id.slice(6);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
// Adds parameters to a query for a digest.
|
|
107
|
+
const populateQuery = async (report, query) => {
|
|
108
|
+
const {
|
|
109
|
+
browserID, device, id, isolate, lowMotion, score, sources, standard, strict, target
|
|
110
|
+
} = report;
|
|
111
|
+
const {agent, requester, script} = sources;
|
|
112
|
+
const {scoreProcID, summary, details} = score;
|
|
113
|
+
query.ts = script;
|
|
114
|
+
query.sp = scoreProcID;
|
|
115
|
+
query.dp = digesterID;
|
|
116
|
+
// Add the job data to the query.
|
|
117
|
+
query.dateISO = getNowDate();
|
|
118
|
+
query.dateSlash = getNowDateSlash();
|
|
119
|
+
query.org = target.what;
|
|
120
|
+
query.url = target.url;
|
|
121
|
+
query.redirections = strict ? 'prohibited' : 'permitted';
|
|
122
|
+
query.isolation = isolate ? 'yes' : 'no';
|
|
123
|
+
query.standard
|
|
124
|
+
= ['original', 'standard', 'original and standard'][['no', 'only', 'also'].indexOf(standard)];
|
|
125
|
+
query.motion = lowMotion ? 'requested' : 'not requested';
|
|
126
|
+
query.requester = requester;
|
|
127
|
+
query.device = device.id;
|
|
128
|
+
query.browser = browserID;
|
|
129
|
+
query.agent = agent ? ` on agent ${agent}` : '';
|
|
130
|
+
query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
|
|
131
|
+
// Populate the WCAG phrase directory.
|
|
132
|
+
await getWCAGPhrases();
|
|
133
|
+
// Add values for the score-summary table to the query.
|
|
134
|
+
const rows = {
|
|
135
|
+
summaryRows: [],
|
|
136
|
+
issueRows: []
|
|
137
|
+
};
|
|
138
|
+
['total', 'issueCount', 'issue', 'solo', 'tool', 'element', 'prevention', 'log', 'latency']
|
|
139
|
+
.forEach(sumItem => {
|
|
140
|
+
query[sumItem] = summary[sumItem];
|
|
141
|
+
rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
|
|
142
|
+
});
|
|
143
|
+
// Sort the issue IDs in descending score order.
|
|
144
|
+
const issueIDs = Object.keys(details.issue);
|
|
145
|
+
issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
|
|
146
|
+
// Get rows for the issue-score table.
|
|
147
|
+
issueIDs.forEach(issueID => {
|
|
148
|
+
if (issues[issueID]) {
|
|
149
|
+
rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
console.log(`ERROR: Issue ${issueID} not found`);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Add the rows to the query.
|
|
156
|
+
['summaryRows', 'issueRows'].forEach(rowType => {
|
|
157
|
+
query[rowType] = rows[rowType].join(innerJoiner);
|
|
158
|
+
});
|
|
159
|
+
// Add paragraph groups about the issue details to the query.
|
|
160
|
+
const issueDetailRows = [];
|
|
161
|
+
issueIDs.forEach(issueID => {
|
|
162
|
+
const issueSummary = issues[issueID].summary;
|
|
163
|
+
issueDetailRows.push(`<h3 class="bars">Issue: ${issueSummary}</h3>`);
|
|
164
|
+
issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
|
|
165
|
+
const wcag = issues[issueID].wcag;
|
|
166
|
+
const wcagTerm = wcag ? getWCAGTerm(wcag) : 'N/A';
|
|
167
|
+
issueDetailRows.push(`<p>WCAG: ${wcagTerm}</p>`);
|
|
168
|
+
const issueData = details.issue[issueID];
|
|
169
|
+
issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
|
|
170
|
+
issueDetailRows.push('<h4>Elements</h4>');
|
|
171
|
+
const issuePaths = details.element[issueID];
|
|
172
|
+
if (issuePaths.length) {
|
|
173
|
+
issueDetailRows.push('<ul>');
|
|
174
|
+
issuePaths.forEach(pathID => {
|
|
175
|
+
issueDetailRows.push(` <li>${pathID}</li>`);
|
|
176
|
+
});
|
|
177
|
+
issueDetailRows.push('</ul>');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
issueDetailRows.push('<p>None identified</p>');
|
|
181
|
+
}
|
|
182
|
+
const toolIDs = Object.keys(issueData.tools);
|
|
183
|
+
toolIDs.forEach(toolID => {
|
|
184
|
+
issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h4>`);
|
|
185
|
+
const ruleIDs = Object.keys(issueData.tools[toolID]);
|
|
186
|
+
ruleIDs.forEach(ruleID => {
|
|
187
|
+
const ruleData = issueData.tools[toolID][ruleID];
|
|
188
|
+
issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
|
|
189
|
+
issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
|
|
190
|
+
issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
|
|
191
|
+
/*
|
|
192
|
+
This fails unless the caller handles such URLs and has compatible scored report URLs.
|
|
193
|
+
const href = `${query.reportURL}?tool=${toolID}&rule=${ruleID}`;
|
|
194
|
+
const detailLabel = `Issue ${issueSummary} tool ${toolID} rule ${ruleID} instance details`;
|
|
195
|
+
issueDetailRows.push(
|
|
196
|
+
`<p><a href="${href}" aria-label="${detailLabel}">Instance details</a></p>`
|
|
197
|
+
);
|
|
198
|
+
*/
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
query.issueDetailRows = issueDetailRows.join(outerJoiner);
|
|
203
|
+
// Add paragraphs about the elements to the query.
|
|
204
|
+
const elementRows = [];
|
|
205
|
+
const issueElements = {};
|
|
206
|
+
Object.keys(details.element).forEach(issueID => {
|
|
207
|
+
const pathIDs = details.element[issueID];
|
|
208
|
+
pathIDs.forEach(pathID => {
|
|
209
|
+
issueElements[pathID] ??= [];
|
|
210
|
+
issueElements[pathID].push(issueID);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
const sortedPathIDs = Object.keys(issueElements).sort();
|
|
214
|
+
sortedPathIDs.forEach(pathID => {
|
|
215
|
+
const elementIssues = issueElements[pathID];
|
|
216
|
+
if (elementIssues) {
|
|
217
|
+
elementRows.push(
|
|
218
|
+
`<h5>Element <code>${pathID}</code></h5>`,
|
|
219
|
+
'<ul>',
|
|
220
|
+
... elementIssues.map(issueID => ` <li>${issues[issueID].summary}</li>`).sort(),
|
|
221
|
+
'</ul>'
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
query.elementRows = elementRows.join(outerJoiner);
|
|
226
|
+
};
|
|
227
|
+
// Returns a digested report.
|
|
228
|
+
exports.digester = async report => {
|
|
229
|
+
// Create a query to replace placeholders.
|
|
230
|
+
const query = {};
|
|
231
|
+
await populateQuery(report, query);
|
|
232
|
+
// Get the template.
|
|
233
|
+
let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
|
|
234
|
+
// Replace its placeholders.
|
|
235
|
+
Object.keys(query).forEach(param => {
|
|
236
|
+
template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
|
|
237
|
+
});
|
|
238
|
+
// Return the digest.
|
|
239
|
+
return template;
|
|
240
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<!DOCTYPE HTML>
|
|
2
|
+
<html lang="en-US">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="author" content="Testilo">
|
|
7
|
+
<meta name="creator" content="Testilo">
|
|
8
|
+
<meta name="publisher" name="Testilo">
|
|
9
|
+
<meta name="description" content="report of accessibility testing of a web page">
|
|
10
|
+
<meta name="keywords" content="accessibility a11y web testing">
|
|
11
|
+
<title>Accessibility digest</title>
|
|
12
|
+
<link rel="icon" href="favicon.ico">
|
|
13
|
+
<link rel="stylesheet" href="style.css">
|
|
14
|
+
<script id="script" type="module">
|
|
15
|
+
const sortByA = document.getElementById('sortByA');
|
|
16
|
+
const sortByB = document.getElementById('sortByB');
|
|
17
|
+
const sortBasisSpan = document.getElementById('sortBasis');
|
|
18
|
+
const sortBasisASpan = document.getElementById('sortBasisA');
|
|
19
|
+
const sortBasisBSpan = document.getElementById('sortBasisB');
|
|
20
|
+
const sumBody = document.getElementById('sumBody');
|
|
21
|
+
const rows = Array.from(sumBody.children);
|
|
22
|
+
const sortBases = {
|
|
23
|
+
WCAG: {
|
|
24
|
+
col: 1,
|
|
25
|
+
A: 'weight',
|
|
26
|
+
B: 'score'
|
|
27
|
+
},
|
|
28
|
+
weight: {
|
|
29
|
+
col: 2,
|
|
30
|
+
A: 'WCAG',
|
|
31
|
+
B: 'score'
|
|
32
|
+
},
|
|
33
|
+
score: {
|
|
34
|
+
col: 3,
|
|
35
|
+
A: 'WCAG',
|
|
36
|
+
B: 'weight'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// FUNCTION DEFINITION START
|
|
40
|
+
const sortRowsBy = basis => {
|
|
41
|
+
if (basis === 'WCAG') {
|
|
42
|
+
rows.sort((a, b) => {
|
|
43
|
+
const sorters = [a, b].map(row => {
|
|
44
|
+
const wcagParts = row.children[sortBases[basis].col].textContent.split('.');
|
|
45
|
+
const wcagNums = wcagParts.map(part => Number.parseInt(part, 10));
|
|
46
|
+
return 100 * (wcagNums[0] || 0) + 20 * (wcagNums[1] || 0) + (wcagNums[2] || 0);
|
|
47
|
+
});
|
|
48
|
+
return sorters[0] - sorters[1];
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if (basis === 'weight') {
|
|
52
|
+
rows.sort((a, b) => {
|
|
53
|
+
const sorters = [a, b].map(row => row.children[sortBases[basis].col].textContent);
|
|
54
|
+
return sorters[1] - sorters[0];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else if (basis === 'score') {
|
|
58
|
+
rows.sort((a, b) => {
|
|
59
|
+
const sorters = [a, b]
|
|
60
|
+
.map(row => Number.parseInt(row.children[sortBases[basis].col].textContent));
|
|
61
|
+
return sorters[1] - sorters[0];
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
sumBody.textContent = '';
|
|
65
|
+
rows.forEach(row => {
|
|
66
|
+
sumBody.appendChild(row);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
// FUNCTION DEFINITION END
|
|
70
|
+
// When a sort button is activated:
|
|
71
|
+
document.getElementById('sortButtons').addEventListener('click', event => {
|
|
72
|
+
const whichButton = event.target.id.slice(-1);
|
|
73
|
+
const oldBasis = sortBasisSpan.textContent;
|
|
74
|
+
const newBasis = sortBases[oldBasis][whichButton];
|
|
75
|
+
// Re-sort the table.
|
|
76
|
+
sortRowsBy(newBasis);
|
|
77
|
+
// Revise the variable texts.
|
|
78
|
+
sortBasisSpan.textContent = newBasis;
|
|
79
|
+
sortBasisASpan.textContent = sortBases[newBasis].A;
|
|
80
|
+
sortBasisBSpan.textContent = sortBases[newBasis].B;
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
</head>
|
|
84
|
+
<body>
|
|
85
|
+
<main>
|
|
86
|
+
<header>
|
|
87
|
+
<h1>Accessibility digest</h1>
|
|
88
|
+
<h2>Contents</h2>
|
|
89
|
+
<ul>
|
|
90
|
+
<li><a href="#intro">Introduction</a></li>
|
|
91
|
+
<li><a href="#summary">Issue summary</a></li>
|
|
92
|
+
<li><a href="#itemization">Itemized issues</a></li>
|
|
93
|
+
<li><a href="#elements">Elements with issues</a></li>
|
|
94
|
+
</ul>
|
|
95
|
+
<table class="allBorder">
|
|
96
|
+
<caption>Synopsis</caption>
|
|
97
|
+
<tr><th>Page</th><td>__org__</td></tr>
|
|
98
|
+
<tr><th>URL</th><td>__url__</td></tr>
|
|
99
|
+
<tr><th>Test date</th><td>__dateSlash__</td></tr>
|
|
100
|
+
<tr><th>Score</th><td>__total__</td></tr>
|
|
101
|
+
</table>
|
|
102
|
+
<table class="allBorder">
|
|
103
|
+
<caption>Configuration</caption>
|
|
104
|
+
<tr><th>Redirections</th><td>__redirections__</td></tr>
|
|
105
|
+
<tr><th>Tool isolation</th><td>__isolation__</td></tr>
|
|
106
|
+
<tr><th>Report format(s)</th><td>__standard__</td></tr>
|
|
107
|
+
<tr><th>Requester</th><td>__requester__</td></tr>
|
|
108
|
+
<tr><th>Device</th><td>__device__</td></tr>
|
|
109
|
+
<tr><th>Browser type</th><td>__browser__</td></tr>
|
|
110
|
+
<tr><th>Reduced motion</th><td>__motion__</td></tr>
|
|
111
|
+
<tr><th>Tested by</th><td>Testaro__agent__, procedure <code>__ts__</code></td></tr>
|
|
112
|
+
<tr><th>Scored by</th><td>Testilo, procedure <code>__sp__</code></td></tr>
|
|
113
|
+
<tr><th>Digested by</th><td>Testilo, procedure <code>__dp__</code></td></tr>
|
|
114
|
+
<tr>
|
|
115
|
+
<th>Full report</th>
|
|
116
|
+
<td><a href="__reportURL__"><code>__reportURL__</code></a></td>
|
|
117
|
+
</tr>
|
|
118
|
+
</table>
|
|
119
|
+
</header>
|
|
120
|
+
<h2 id="intro">Introduction</h2>
|
|
121
|
+
<p>How <a href="https://www.w3.org/WAI/">accessible</a> is the __org__ web page at <a href="__url__"><code>__url__</code></a>?</p>
|
|
122
|
+
<p>This digest can help answer that question. Ten different tools (Alfa, ASLint, Axe, Editoria11y, Equal Access, HTML CodeSniffer, Nu Html Checker, QualWeb, Testaro, and WAVE) tested the page to check its compliance with their accessibility rules. In all, the tools define about 990 rules, which are classified here into about 310 accessibility issues.</p>
|
|
123
|
+
<p>The results were interpreted to yield a score, with 0 being ideal. The score for this page was __total__, the sum of __issueCount__ for the count of issues, __issue__ for specific issues, __solo__ for unclassified rule violations, __tool__ for tool-by-tool ratings, __element__ for the count of violating elements, __prevention__ for the page preventing tools from running, __log__ for browser warnings, and __latency__ for delayed page responses.</p>
|
|
124
|
+
<h2 id="summary">Issue summary</h2>
|
|
125
|
+
<h3>Details about this summary</h3>
|
|
126
|
+
<ul>
|
|
127
|
+
<li>This table shows the numbers of rule violations (<q>instances</q>) reported by one or more tools, classified by issue.</li>
|
|
128
|
+
<li>Tools often disagree on instance counts, because of non-equivalent rules or invalid tests. You can inspect the <a href="__reportURL__">full report</a> to diagnose differences.</li>
|
|
129
|
+
<li>The <q>WCAG</q> value is the principle, guideline, or success criterion of the <a href="https://www.w3.org/TR/WCAG22/">Web Content Accessibility Guidelines</a> most relevant to the issue.</li>
|
|
130
|
+
<li>The <q>Weight</q> value estimates the importance of an instance of the issue, from 1 (minor or advisory) to 4 (serious).</li>
|
|
131
|
+
<li>The <q>Score</q> value is the contribution of the instances of the issue to the page score.</li>
|
|
132
|
+
<li>An instance count of 0 means the tool has a rule belonging to the issue but reported no violations of that rule, although at least one tool reported at least one violation.</li>
|
|
133
|
+
<li>You can sort this table by WCAG, weight, or score.</li>
|
|
134
|
+
</ul>
|
|
135
|
+
<h3>The summary</h3>
|
|
136
|
+
<p role="status">Sorting is by <span id="sortBasis">score</span>.</p>
|
|
137
|
+
<p id="sortButtons">
|
|
138
|
+
<button id="sortButtonA" type="button">Sort by <span id="sortBasisA">WCAG</span></button>
|
|
139
|
+
<button id="sortButtonB" type="button">Sort by <span id="sortBasisB">weight</span></button>
|
|
140
|
+
</p>
|
|
141
|
+
<table class="allBorder thirdCellRight">
|
|
142
|
+
<caption>How many violations each tool reported, by issue</caption>
|
|
143
|
+
<thead>
|
|
144
|
+
<tr><th>Issue</th><th>WCAG</th><th>Weight</th><th>Score</th><th>Instance counts</th></tr>
|
|
145
|
+
</thead>
|
|
146
|
+
<tbody id="sumBody" class="headersLeft">
|
|
147
|
+
__issueRows__
|
|
148
|
+
</tbody>
|
|
149
|
+
</table>
|
|
150
|
+
<h2 id="itemization">Itemized issues</h2>
|
|
151
|
+
<p>The reported rule violations are itemized below, issue by issue. Additional details can be inspected in the <a href="__reportURL__">full report</a>.</p>
|
|
152
|
+
__issueDetailRows__
|
|
153
|
+
<h2 id="elements">Elements with issues</h2>
|
|
154
|
+
<p>Elements exhibiting issues:</p>
|
|
155
|
+
__elementRows__
|
|
156
|
+
<footer>
|
|
157
|
+
<p class="date">Produced <time itemprop="datePublished" datetime="__dateISO__">__dateSlash__</time></p>
|
|
158
|
+
</footer>
|
|
159
|
+
</main>
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
© 2024 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// index: digester for scoring procedure tsp43.
|
|
24
|
+
|
|
25
|
+
// IMPORTS
|
|
26
|
+
|
|
27
|
+
// Module to keep secrets.
|
|
28
|
+
require('dotenv').config();
|
|
29
|
+
// Module to classify tool rules into issues
|
|
30
|
+
const {issues} = require('../../score/tic45');
|
|
31
|
+
// Module to process files.
|
|
32
|
+
const fs = require('fs/promises');
|
|
33
|
+
// Utility module.
|
|
34
|
+
const {getNowDate, getNowDateSlash} = require('../../util');
|
|
35
|
+
|
|
36
|
+
// CONSTANTS
|
|
37
|
+
|
|
38
|
+
// Digester ID.
|
|
39
|
+
const digesterID = 'tdp48';
|
|
40
|
+
// Newline with indentations.
|
|
41
|
+
const innerJoiner = '\n ';
|
|
42
|
+
const outerJoiner = '\n ';
|
|
43
|
+
// Directory of WCAG links.
|
|
44
|
+
const wcagPhrases = {};
|
|
45
|
+
|
|
46
|
+
// FUNCTIONS
|
|
47
|
+
|
|
48
|
+
// Gets a row of the score-summary table.
|
|
49
|
+
const getScoreRow = (componentName, score) => `<tr><th>${componentName}</th><td>${score}</td></tr>`;
|
|
50
|
+
// Gets a WCAG link or, if not obtainable, a numeric identifier.
|
|
51
|
+
const getWCAGTerm = wcag => {
|
|
52
|
+
const wcagPhrase = wcagPhrases[wcag];
|
|
53
|
+
const wcagTerm = wcagPhrase
|
|
54
|
+
? `<a href="https://www.w3.org/WAI/WCAG22/Understanding/${wcagPhrase}.html">${wcag}</a>`
|
|
55
|
+
: wcag;
|
|
56
|
+
return wcagTerm;
|
|
57
|
+
};
|
|
58
|
+
// Gets a row of the issue-score-summary table.
|
|
59
|
+
const getIssueScoreRow = (issueConstants, issueDetails) => {
|
|
60
|
+
const {summary, wcag, weight} = issueConstants;
|
|
61
|
+
const wcagTerm = getWCAGTerm(wcag);
|
|
62
|
+
const {instanceCounts, score} = issueDetails;
|
|
63
|
+
const toolList = Object
|
|
64
|
+
.keys(instanceCounts)
|
|
65
|
+
.map(tool => `<code>${tool}</code>:${instanceCounts[tool]}`)
|
|
66
|
+
.join(', ');
|
|
67
|
+
return `<tr><th>${summary}</th><td class="center">${wcagTerm}<td class="right num">${weight}</td><td class="right num">${score}</td><td>${toolList}</td></tr>`;
|
|
68
|
+
};
|
|
69
|
+
// Populates the directory of WCAG understanding verbal IDs.
|
|
70
|
+
const getWCAGPhrases = async () => {
|
|
71
|
+
// Get the copy of file https://raw.githubusercontent.com/w3c/wcag/main/guidelines/wcag.json.
|
|
72
|
+
const wcagJSON = await fs.readFile(`${__dirname}/../../../wcag.json`, 'utf8');
|
|
73
|
+
const wcag = JSON.parse(wcagJSON);
|
|
74
|
+
const {principles} = wcag;
|
|
75
|
+
// For each principle in it:
|
|
76
|
+
principles.forEach(principle => {
|
|
77
|
+
// If it is usable:
|
|
78
|
+
if (principle.num && principle.id && principle.id.startsWith('WCAG2:')) {
|
|
79
|
+
// Add it to the directory.
|
|
80
|
+
wcagPhrases[principle.num] = principle.id.slice(6);
|
|
81
|
+
const {guidelines} = principle;
|
|
82
|
+
// For each guideline in the principle:
|
|
83
|
+
guidelines.forEach(guideline => {
|
|
84
|
+
// If it is usable:
|
|
85
|
+
if (guideline.num && guideline.id && guideline.id.startsWith('WCAG2:')) {
|
|
86
|
+
// Add it to the directory.
|
|
87
|
+
wcagPhrases[guideline.num] = guideline.id.slice(6);
|
|
88
|
+
const {successcriteria} = guideline;
|
|
89
|
+
// For each success criterion in the guideline:
|
|
90
|
+
successcriteria.forEach(successCriterion => {
|
|
91
|
+
// If it is usable:
|
|
92
|
+
if (
|
|
93
|
+
successCriterion.num
|
|
94
|
+
&& successCriterion.id
|
|
95
|
+
&& successCriterion.id.startsWith('WCAG2:')
|
|
96
|
+
) {
|
|
97
|
+
// Add it to the directory.
|
|
98
|
+
wcagPhrases[successCriterion.num] = successCriterion.id.slice(6);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
// Adds parameters to a query for a digest.
|
|
107
|
+
const populateQuery = async (report, query) => {
|
|
108
|
+
const {
|
|
109
|
+
browserID, device, id, isolate, lowMotion, score, sources, standard, strict, target
|
|
110
|
+
} = report;
|
|
111
|
+
const {agent, requester, script} = sources;
|
|
112
|
+
const {scoreProcID, summary, details} = score;
|
|
113
|
+
query.ts = script;
|
|
114
|
+
query.sp = scoreProcID;
|
|
115
|
+
query.dp = digesterID;
|
|
116
|
+
// Add the job data to the query.
|
|
117
|
+
query.dateISO = getNowDate();
|
|
118
|
+
query.dateSlash = getNowDateSlash();
|
|
119
|
+
query.org = target.what;
|
|
120
|
+
query.url = target.url;
|
|
121
|
+
query.redirections = strict ? 'prohibited' : 'permitted';
|
|
122
|
+
query.isolation = isolate ? 'yes' : 'no';
|
|
123
|
+
query.standard
|
|
124
|
+
= ['original', 'standard', 'original and standard'][['no', 'only', 'also'].indexOf(standard)];
|
|
125
|
+
query.motion = lowMotion ? 'requested' : 'not requested';
|
|
126
|
+
query.requester = requester;
|
|
127
|
+
query.device = device.id;
|
|
128
|
+
query.browser = browserID;
|
|
129
|
+
query.agent = agent ? ` on agent ${agent}` : '';
|
|
130
|
+
query.reportURL = process.env.SCORED_REPORT_URL.replace('__id__', id);
|
|
131
|
+
// Populate the WCAG phrase directory.
|
|
132
|
+
await getWCAGPhrases();
|
|
133
|
+
// Add values for the score-summary table to the query.
|
|
134
|
+
const rows = {
|
|
135
|
+
summaryRows: [],
|
|
136
|
+
issueRows: []
|
|
137
|
+
};
|
|
138
|
+
['total', 'issueCount', 'issue', 'solo', 'tool', 'element', 'prevention', 'log', 'latency']
|
|
139
|
+
.forEach(sumItem => {
|
|
140
|
+
query[sumItem] = summary[sumItem];
|
|
141
|
+
rows.summaryRows.push(getScoreRow(sumItem, query[sumItem]));
|
|
142
|
+
});
|
|
143
|
+
// Sort the issue IDs in descending score order.
|
|
144
|
+
const issueIDs = Object.keys(details.issue);
|
|
145
|
+
issueIDs.sort((a, b) => details.issue[b].score - details.issue[a].score);
|
|
146
|
+
// Get rows for the issue-score table.
|
|
147
|
+
issueIDs.forEach(issueID => {
|
|
148
|
+
if (issues[issueID]) {
|
|
149
|
+
rows.issueRows.push(getIssueScoreRow(issues[issueID], details.issue[issueID]));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
console.log(`ERROR: Issue ${issueID} not found`);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
// Add the rows to the query.
|
|
156
|
+
['summaryRows', 'issueRows'].forEach(rowType => {
|
|
157
|
+
query[rowType] = rows[rowType].join(innerJoiner);
|
|
158
|
+
});
|
|
159
|
+
// Add paragraph groups about the issue details to the query.
|
|
160
|
+
const issueDetailRows = [];
|
|
161
|
+
issueIDs.forEach(issueID => {
|
|
162
|
+
const issueSummary = issues[issueID].summary;
|
|
163
|
+
issueDetailRows.push(`<h3 class="bars">Issue: ${issueSummary}</h3>`);
|
|
164
|
+
issueDetailRows.push(`<p>Impact: ${issues[issueID].why || 'N/A'}</p>`);
|
|
165
|
+
const wcag = issues[issueID].wcag;
|
|
166
|
+
const wcagTerm = wcag ? getWCAGTerm(wcag) : 'N/A';
|
|
167
|
+
issueDetailRows.push(`<p>WCAG: ${wcagTerm}</p>`);
|
|
168
|
+
const issueData = details.issue[issueID];
|
|
169
|
+
issueDetailRows.push(`<p>Score: ${issueData.score}</p>`);
|
|
170
|
+
issueDetailRows.push('<h4>Elements</h4>');
|
|
171
|
+
const issuePaths = details.element[issueID];
|
|
172
|
+
if (issuePaths.length) {
|
|
173
|
+
issueDetailRows.push('<ul>');
|
|
174
|
+
issuePaths.forEach(pathID => {
|
|
175
|
+
issueDetailRows.push(` <li>${pathID}</li>`);
|
|
176
|
+
});
|
|
177
|
+
issueDetailRows.push('</ul>');
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
issueDetailRows.push('<p>None identified</p>');
|
|
181
|
+
}
|
|
182
|
+
const toolIDs = Object.keys(issueData.tools);
|
|
183
|
+
toolIDs.forEach(toolID => {
|
|
184
|
+
issueDetailRows.push(`<h4>Violations of <code>${toolID}</code> rules</h4>`);
|
|
185
|
+
const ruleIDs = Object.keys(issueData.tools[toolID]);
|
|
186
|
+
ruleIDs.forEach(ruleID => {
|
|
187
|
+
const ruleData = issueData.tools[toolID][ruleID];
|
|
188
|
+
issueDetailRows.push(`<h5>Rule <code>${ruleID}</code></h5>`);
|
|
189
|
+
issueDetailRows.push(`<p>Description: ${ruleData.what}</p>`);
|
|
190
|
+
issueDetailRows.push(`<p>Count of instances: ${ruleData.complaints.countTotal}</p>`);
|
|
191
|
+
/*
|
|
192
|
+
This fails unless the caller handles such URLs and has compatible scored report URLs.
|
|
193
|
+
const href = `${query.reportURL}?tool=${toolID}&rule=${ruleID}`;
|
|
194
|
+
const detailLabel = `Issue ${issueSummary} tool ${toolID} rule ${ruleID} instance details`;
|
|
195
|
+
issueDetailRows.push(
|
|
196
|
+
`<p><a href="${href}" aria-label="${detailLabel}">Instance details</a></p>`
|
|
197
|
+
);
|
|
198
|
+
*/
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
query.issueDetailRows = issueDetailRows.join(outerJoiner);
|
|
203
|
+
// Add paragraphs about the elements to the query.
|
|
204
|
+
const elementRows = [];
|
|
205
|
+
const issueElements = {};
|
|
206
|
+
Object.keys(details.element).forEach(issueID => {
|
|
207
|
+
const pathIDs = details.element[issueID];
|
|
208
|
+
pathIDs.forEach(pathID => {
|
|
209
|
+
issueElements[pathID] ??= [];
|
|
210
|
+
issueElements[pathID].push(issueID);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
const sortedPathIDs = Object.keys(issueElements).sort();
|
|
214
|
+
sortedPathIDs.forEach(pathID => {
|
|
215
|
+
const elementIssues = issueElements[pathID];
|
|
216
|
+
if (elementIssues) {
|
|
217
|
+
elementRows.push(
|
|
218
|
+
`<h5>Element <code>${pathID}</code></h5>`,
|
|
219
|
+
'<ul>',
|
|
220
|
+
... elementIssues.map(issueID => ` <li>${issues[issueID].summary}</li>`).sort(),
|
|
221
|
+
'</ul>'
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
query.elementRows = elementRows.join(outerJoiner);
|
|
226
|
+
};
|
|
227
|
+
// Returns a digested report.
|
|
228
|
+
exports.digester = async report => {
|
|
229
|
+
// Create a query to replace placeholders.
|
|
230
|
+
const query = {};
|
|
231
|
+
await populateQuery(report, query);
|
|
232
|
+
// Get the template.
|
|
233
|
+
let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
|
|
234
|
+
// Replace its placeholders.
|
|
235
|
+
Object.keys(query).forEach(param => {
|
|
236
|
+
template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
|
|
237
|
+
});
|
|
238
|
+
// Return the digest.
|
|
239
|
+
return template;
|
|
240
|
+
};
|
package/procs/score/tic45.js
CHANGED
|
@@ -1359,7 +1359,7 @@ exports.issues = {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
},
|
|
1361
1361
|
objectAudioRisk: {
|
|
1362
|
-
summary: 'non-audio element
|
|
1362
|
+
summary: 'non-audio element plays audio?',
|
|
1363
1363
|
why: 'User may get inadequate help consuming audio content',
|
|
1364
1364
|
wcag: '1.1.1',
|
|
1365
1365
|
weight: 1,
|
|
@@ -1459,7 +1459,7 @@ exports.issues = {
|
|
|
1459
1459
|
}
|
|
1460
1460
|
},
|
|
1461
1461
|
customKeyboardRisk: {
|
|
1462
|
-
summary: 'custom button
|
|
1462
|
+
summary: 'custom button keyboard-inoperable?',
|
|
1463
1463
|
why: 'Custom item may prevent a keyboard-only user from operating it',
|
|
1464
1464
|
wcag: '2.1.1',
|
|
1465
1465
|
weight: 1,
|
|
@@ -1474,7 +1474,7 @@ exports.issues = {
|
|
|
1474
1474
|
}
|
|
1475
1475
|
},
|
|
1476
1476
|
objectBlurKeyboardRisk: {
|
|
1477
|
-
summary: 'object
|
|
1477
|
+
summary: 'object not keyboard-blurrable?',
|
|
1478
1478
|
why: 'Custom item may trap a keyboard-only user',
|
|
1479
1479
|
wcag: '2.1.1',
|
|
1480
1480
|
weight: 1,
|
|
@@ -1489,7 +1489,7 @@ exports.issues = {
|
|
|
1489
1489
|
}
|
|
1490
1490
|
},
|
|
1491
1491
|
eventKeyboardRisk: {
|
|
1492
|
-
summary: 'event
|
|
1492
|
+
summary: 'event not keyboard-triggerable?',
|
|
1493
1493
|
why: 'Keyboard-only user may be unable to perform an action',
|
|
1494
1494
|
wcag: '2.1.1',
|
|
1495
1495
|
weight: 1,
|
|
@@ -2316,7 +2316,7 @@ exports.issues = {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
},
|
|
2318
2318
|
newTabSurpriseRisk: {
|
|
2319
|
-
summary: 'tab-opening link action
|
|
2319
|
+
summary: 'tab-opening link action unstated?',
|
|
2320
2320
|
why: 'Following a link opens a new window, possibly surprising a user',
|
|
2321
2321
|
wcag: '3.2.5',
|
|
2322
2322
|
weight: 1,
|
|
@@ -2350,7 +2350,7 @@ exports.issues = {
|
|
|
2350
2350
|
}
|
|
2351
2351
|
},
|
|
2352
2352
|
selectNavSurpriseRisk: {
|
|
2353
|
-
summary: 'navigating selection-change action
|
|
2353
|
+
summary: 'navigating selection-change action unstated?',
|
|
2354
2354
|
why: 'Changing a selected option opens a new window, possibly surprising a user',
|
|
2355
2355
|
wcag: '3.2.5',
|
|
2356
2356
|
weight: 1,
|
|
@@ -2995,7 +2995,7 @@ exports.issues = {
|
|
|
2995
2995
|
}
|
|
2996
2996
|
},
|
|
2997
2997
|
overflowHiddenRisk: {
|
|
2998
|
-
summary: 'overflow
|
|
2998
|
+
summary: 'overflow hidden?',
|
|
2999
2999
|
why: 'User may be unable to enlarge the text for readability',
|
|
3000
3000
|
wcag: '1.4.4',
|
|
3001
3001
|
weight: 1,
|
|
@@ -3394,7 +3394,7 @@ exports.issues = {
|
|
|
3394
3394
|
}
|
|
3395
3395
|
},
|
|
3396
3396
|
roleHierarchyBad: {
|
|
3397
|
-
summary: 'ancestor and descendant
|
|
3397
|
+
summary: 'ancestor and descendant roles incompatible',
|
|
3398
3398
|
why: 'User may misunderstand or be blocked from exposure to an item',
|
|
3399
3399
|
wcag: '4.1.2',
|
|
3400
3400
|
weight: 4,
|
|
@@ -3707,7 +3707,7 @@ exports.issues = {
|
|
|
3707
3707
|
}
|
|
3708
3708
|
},
|
|
3709
3709
|
roleMissingRisk: {
|
|
3710
|
-
summary: 'role
|
|
3710
|
+
summary: 'role missing?',
|
|
3711
3711
|
why: 'Item may behave improperly',
|
|
3712
3712
|
wcag: '4.1.2',
|
|
3713
3713
|
weight: 1,
|
|
@@ -3751,7 +3751,7 @@ exports.issues = {
|
|
|
3751
3751
|
}
|
|
3752
3752
|
},
|
|
3753
3753
|
ariaMissingRisk: {
|
|
3754
|
-
summary: 'aria attribute
|
|
3754
|
+
summary: 'aria attribute missing?',
|
|
3755
3755
|
why: 'Item may behave improperly',
|
|
3756
3756
|
wcag: '4.1.2',
|
|
3757
3757
|
weight: 2,
|
|
@@ -4157,7 +4157,7 @@ exports.issues = {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
},
|
|
4159
4159
|
colorNamedRisk: {
|
|
4160
|
-
summary: 'color perception
|
|
4160
|
+
summary: 'color perception required?',
|
|
4161
4161
|
why: 'Content is impossible to perceive under some conditions',
|
|
4162
4162
|
wcag: '1.4.1',
|
|
4163
4163
|
weight: 1,
|
|
@@ -5047,7 +5047,7 @@ exports.issues = {
|
|
|
5047
5047
|
}
|
|
5048
5048
|
},
|
|
5049
5049
|
justificationRisk: {
|
|
5050
|
-
summary: 'justification
|
|
5050
|
+
summary: 'justification undefined?',
|
|
5051
5051
|
why: 'Text may be difficult to read',
|
|
5052
5052
|
wcag: '1.4.8',
|
|
5053
5053
|
weight: 1,
|
|
@@ -5323,7 +5323,7 @@ exports.issues = {
|
|
|
5323
5323
|
}
|
|
5324
5324
|
},
|
|
5325
5325
|
pseudoListRisk: {
|
|
5326
|
-
summary: 'list
|
|
5326
|
+
summary: 'list not marked as such?',
|
|
5327
5327
|
why: 'User may be unable to get help on which items are in lists',
|
|
5328
5328
|
wcag: '1.3.1',
|
|
5329
5329
|
weight: 1,
|
|
@@ -5445,7 +5445,7 @@ exports.issues = {
|
|
|
5445
5445
|
}
|
|
5446
5446
|
},
|
|
5447
5447
|
selectFlatRisk: {
|
|
5448
|
-
summary: 'option groups
|
|
5448
|
+
summary: 'option groups not marked?',
|
|
5449
5449
|
why: 'User may be unable to get help recognizing groups of options',
|
|
5450
5450
|
wcag: '1.3.1',
|
|
5451
5451
|
weight: 1,
|
|
@@ -5526,7 +5526,7 @@ exports.issues = {
|
|
|
5526
5526
|
}
|
|
5527
5527
|
},
|
|
5528
5528
|
fieldSetRisk: {
|
|
5529
|
-
summary: 'fieldset
|
|
5529
|
+
summary: 'fieldset missing?',
|
|
5530
5530
|
why: 'User may be unable to get help recognizing a group of related form items',
|
|
5531
5531
|
wcag: '1.3.1',
|
|
5532
5532
|
weight: 1,
|
|
@@ -5889,7 +5889,7 @@ exports.issues = {
|
|
|
5889
5889
|
}
|
|
5890
5890
|
},
|
|
5891
5891
|
cellHeadersAmbiguityRisk: {
|
|
5892
|
-
summary: 'cell headers
|
|
5892
|
+
summary: 'cell headers ambiguous?',
|
|
5893
5893
|
why: 'User may be unable to get help on relationships in a table',
|
|
5894
5894
|
wcag: '1.3.1',
|
|
5895
5895
|
weight: 2,
|
|
@@ -6001,7 +6001,7 @@ exports.issues = {
|
|
|
6001
6001
|
}
|
|
6002
6002
|
},
|
|
6003
6003
|
TableHeaderScopeRisk: {
|
|
6004
|
-
summary: 'Table scope
|
|
6004
|
+
summary: 'Table scope ambiguous?',
|
|
6005
6005
|
why: 'User may be unable to get help on relationships in a table',
|
|
6006
6006
|
wcag: '1.3.1',
|
|
6007
6007
|
weight: 1,
|
|
@@ -8108,7 +8108,7 @@ exports.issues = {
|
|
|
8108
8108
|
}
|
|
8109
8109
|
},
|
|
8110
8110
|
audioTextRisk: {
|
|
8111
|
-
summary: 'audio
|
|
8111
|
+
summary: 'audio not named?',
|
|
8112
8112
|
why: 'User may be unable to get help reading speech as text',
|
|
8113
8113
|
wcag: '1.2.1',
|
|
8114
8114
|
weight: 1,
|
|
@@ -8185,7 +8185,7 @@ exports.issues = {
|
|
|
8185
8185
|
}
|
|
8186
8186
|
},
|
|
8187
8187
|
videoCaptionRisk: {
|
|
8188
|
-
summary: 'audio or video alternatives
|
|
8188
|
+
summary: 'audio or video alternatives missing?',
|
|
8189
8189
|
why: 'User may be unable to get help reading video content as text',
|
|
8190
8190
|
wcag: '1.2.2',
|
|
8191
8191
|
weight: 1,
|
|
@@ -8306,7 +8306,7 @@ exports.issues = {
|
|
|
8306
8306
|
}
|
|
8307
8307
|
},
|
|
8308
8308
|
scrollFocus: {
|
|
8309
|
-
summary: 'scrollable element and
|
|
8309
|
+
summary: 'scrollable element and children nonfocusable',
|
|
8310
8310
|
why: 'User may be unable to see all of an item without scrolling in both dimensions',
|
|
8311
8311
|
wcag: '2.1.1',
|
|
8312
8312
|
weight: 3,
|
|
@@ -8371,7 +8371,7 @@ exports.issues = {
|
|
|
8371
8371
|
}
|
|
8372
8372
|
},
|
|
8373
8373
|
repeatedContentRisk: {
|
|
8374
|
-
summary: 'skip method
|
|
8374
|
+
summary: 'skip method missing or invalid?',
|
|
8375
8375
|
why: 'Keyboard-only user may be unable easily to reach the specific content of the document',
|
|
8376
8376
|
wcag: '2.4.1',
|
|
8377
8377
|
weight: 1,
|
|
@@ -8453,7 +8453,7 @@ exports.issues = {
|
|
|
8453
8453
|
}
|
|
8454
8454
|
},
|
|
8455
8455
|
noScriptRisk: {
|
|
8456
|
-
summary: 'noscript element
|
|
8456
|
+
summary: 'noscript element not equivalent?',
|
|
8457
8457
|
why: 'User who has disabled JavaScript may be denied some content',
|
|
8458
8458
|
wcag: '4.1',
|
|
8459
8459
|
weight: 1,
|