testilo 3.9.14 → 3.9.15
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
CHANGED
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</header>
|
|
29
29
|
<h2>Introduction</h2>
|
|
30
|
-
<p>This is a report on transactional <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. Suppose a person is visiting a website and wants to engage in some transaction with it. Is the transaction easy, predictable, and safe? If so, the website is <dfn>transactionally accessible</dfn>.
|
|
31
|
-
<p>This
|
|
30
|
+
<p>This is a report on transactional <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. Suppose a person is visiting a website and wants to engage in some transaction with it. Is the transaction easy, predictable, and safe? If so, the website is <dfn>transactionally accessible</dfn>. To achieve transactional accessibility, websites can design transactions that conform to the most common and standard conventions. Then users will correctly guess what to do at each step. Users with some disabilities will especially benefit from being able to use existing knowledge and tools, without the need to discover how to do things on a website.</p>
|
|
31
|
+
<p>This transaction involves learning how to report a web-page issue. The transaction begins when a person opens a web page and notices an accessibility issue on the page. The user wants to report that issue to whoever is responsible for the website. The test assumes that there is a standard transaction structure in such a situation:</p>
|
|
32
32
|
<ol>
|
|
33
|
-
<li>The
|
|
34
|
-
<li>The
|
|
35
|
-
<li>That link takes the
|
|
33
|
+
<li>The user finds an accessibility link on the page.</li>
|
|
34
|
+
<li>The user clicks that link.</li>
|
|
35
|
+
<li>That link takes the user to an accessibility page.</li>
|
|
36
36
|
<li>On the accessibility page, there is a link for sending an email message about accessibility, and there is another link for making a telephone call about accessibility.</li>
|
|
37
37
|
</ol>
|
|
38
|
-
<p>Thus, instead of the
|
|
38
|
+
<p>Thus, instead of the user needing to figure out how this particular website accepts accessibility issue reports, the user is assumed already to know how websites normally accept such reports. So, instead of exploring the site to find its method, the person uses the standard method.</p>
|
|
39
39
|
<h2>Procedures</h2>
|
|
40
40
|
<p>The <a href="https://www.npmjs.com/package/testaro">Testaro</a> application used its <code>tpA11yMessage</code> testing procedure to evaluate the accessibility of this transaction on the __org__ web page at <a href="__url__">__url__</a> on __dateSlash__. Testaro produced a report.</p>
|
|
41
|
-
<p>The <a href="https://www.npmjs.com/package/testilo">Testilo</a> application processed the report and used the <code>spA11yMessage</code> scoring procedure to compute a score for the transaction. The total score is __totalScore__ (where 0 is the worst and
|
|
41
|
+
<p>The <a href="https://www.npmjs.com/package/testilo">Testilo</a> application processed the report and used the <code>spA11yMessage</code> scoring procedure to compute a score for the transaction. The total score is __totalScore__ (where 0 is the worst and 23 is the best possible score). The scored report is appended below.</p>
|
|
42
42
|
<p>Finally, Testilo used procedure <code>dpA11yMessage</code> to produce this digest, briefly explaining how <code>spA11yMessage</code> computed the scores.</p>
|
|
43
43
|
<h2>Score summary</h2>
|
|
44
44
|
<table class="allBorder secondCellRight">
|
|
@@ -47,17 +47,28 @@
|
|
|
47
47
|
__scoreRows__
|
|
48
48
|
</tbody>
|
|
49
49
|
</table>
|
|
50
|
-
<h2>
|
|
50
|
+
<h2>Explanation</h2>
|
|
51
51
|
<p>The components of the total score are:</p>
|
|
52
52
|
<ul>
|
|
53
|
-
<li><code>
|
|
54
|
-
<li><code>
|
|
55
|
-
<li><code>
|
|
56
|
-
<li><code>
|
|
57
|
-
<li><code>
|
|
58
|
-
<li><code>
|
|
53
|
+
<li><code>pageLoad</code>: 2 points if it was possible to visit the page</li>
|
|
54
|
+
<li><code>pageFast</code>: 2 points if the page loaded within 4 seconds, or 1 point if it loaded within 6 seconds</li>
|
|
55
|
+
<li><code>a11yLink</code>: 1 point if the page contained a link whose name included <q>accessibility</q></li>
|
|
56
|
+
<li><code>a11yLinkWork</code>: 2 points if clicking the link produced a new page</li>
|
|
57
|
+
<li><code>a11yLinkFast</code>: 2 points if the new page loaded within 3 seconds, or 1 point if it loaded within 5 seconds</li>
|
|
58
|
+
<li><code>a11yPageTitle</code>: 1 point if the new page had a title</li>
|
|
59
|
+
<li><code>a11yTitleGood</code>: 2 points if the title included <q>accessibility</q></li>
|
|
60
|
+
<li><code>a11yPageH1</code>: 1 point if the new page had 1 level-1 heading</li>
|
|
61
|
+
<li><code>a11yH1Good</code>: 2 points if that heading included <q>accessibility</q></li>
|
|
62
|
+
<li><code>mailLink</code>: 2 points if the new page contained any email (<code>mailto:</code>) link</li>
|
|
63
|
+
<li><code>mailLinkName</code>: 2 points if the name of an email link included <q>accessibility</q>, or 1 point if the context of an email link (i.e. the text content of its parent element) included <q>accessibility</q></li>
|
|
64
|
+
<li><code>telLink</code>: 2 points if the new page contained any telephone (<code>tel:</code>) link</li>
|
|
65
|
+
<li><code>telLinkName</code>: 2 points if the name of a telephone link included <q>accessibility</q>, or 1 point if the context of a telephone link included <q>accessibility</q></li>
|
|
59
66
|
</ul>
|
|
60
67
|
<p>The precise rules of <code>spA11yMessage</code> are found in the <a href="https://github.com/jrpool/testilo/blob/main/procs/score/spA11yMessage.js">code itself</a>.</p>
|
|
68
|
+
<h2>Suggestions</h2>
|
|
69
|
+
<ul>
|
|
70
|
+
__suggestions__
|
|
71
|
+
</ul>
|
|
61
72
|
<h2>Report</h2>
|
|
62
73
|
<pre>__report__</pre>
|
|
63
74
|
<footer>
|
|
@@ -52,4 +52,89 @@ exports.makeQuery = (report, query) => {
|
|
|
52
52
|
});
|
|
53
53
|
query.totalScore = score.total;
|
|
54
54
|
query.scoreRows = scoreRows.join(innerJoiner);
|
|
55
|
+
// Add suggestions to the query.
|
|
56
|
+
const suggestions = [];
|
|
57
|
+
if (score.pageLoad === 0) {
|
|
58
|
+
suggestions.push(['pageLoad', 'Make it possible to visit the page.']);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (score.pageFast < 2) {
|
|
62
|
+
suggestions.push(['pageFast', 'Make the page load faster.']);
|
|
63
|
+
}
|
|
64
|
+
if (score.a11yLink === 0) {
|
|
65
|
+
suggestions.push(['a11yLink', 'Add a link named Accessibility to the page.']);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (score.a11yLinkWork === 0) {
|
|
69
|
+
suggestions.push(['a11yLinkWork', 'Make the Accessibility link open a new page.']);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
if (score.a11yLinkFast < 2) {
|
|
73
|
+
suggestions.push(
|
|
74
|
+
['a11yLinkFast', 'Make the page opened by the Accessibility link load faster.']
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if (score.a11yPageTitle === 0) {
|
|
78
|
+
suggestions.push(['a11yPageTitle', 'Give the accessibility page a title.']);
|
|
79
|
+
}
|
|
80
|
+
else if (score.a11yTitleGood === 0) {
|
|
81
|
+
suggestions.push(
|
|
82
|
+
['a11yTitleGood', 'Include accessibility in the title of the accessibility page.']
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
if (score.a11yPageH1 === 0) {
|
|
86
|
+
suggestions.push(['a11yPageH1', 'Give the accessibility page a single h1 heading.']);
|
|
87
|
+
}
|
|
88
|
+
else if (score.a11yH1Good === 0) {
|
|
89
|
+
suggestions.push(
|
|
90
|
+
[
|
|
91
|
+
'a11yH1Good',
|
|
92
|
+
'Include accessibility in the text of the h1 heading of the accessibility page.'
|
|
93
|
+
]
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (score.mailLink === 0) {
|
|
97
|
+
suggestions.push(['mailLink', 'Add an email (mailto:) link to the accessibility page.']);
|
|
98
|
+
}
|
|
99
|
+
else if (score.mailLinkName === 1) {
|
|
100
|
+
suggestions.push(
|
|
101
|
+
[
|
|
102
|
+
'mailLinkName',
|
|
103
|
+
'Include accessibility not only around, but within, an email link on the accessibility page.'
|
|
104
|
+
]
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
else if (score.mailLinkName === 0) {
|
|
108
|
+
suggestions.push(
|
|
109
|
+
[
|
|
110
|
+
'mailLinkName',
|
|
111
|
+
'Include accessibility in the name of an email link on the accessibility page.'
|
|
112
|
+
]
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (score.telLink === 0) {
|
|
116
|
+
suggestions.push(['telLink', 'Add a telephone (tel:) link to the accessibility page.']);
|
|
117
|
+
}
|
|
118
|
+
else if (score.telLinkName === 1) {
|
|
119
|
+
suggestions.push(
|
|
120
|
+
[
|
|
121
|
+
'telLinkName',
|
|
122
|
+
'Include accessibility not only around, but within, a telephone link on the accessibility page.'
|
|
123
|
+
]
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
else if (score.telLinkName === 0) {
|
|
127
|
+
suggestions.push(
|
|
128
|
+
[
|
|
129
|
+
'telLinkName',
|
|
130
|
+
'Include accessibility in the name of a telephone link on the accessibility page.'
|
|
131
|
+
]
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
query.suggestions = suggestions
|
|
138
|
+
.map(pair => `<li><code>${pair[0]}</code>: ${pair[1]}</li>`)
|
|
139
|
+
.join(innerJoiner);
|
|
55
140
|
};
|
|
@@ -20,17 +20,20 @@ const scoreProcID = 'a11ymessage';
|
|
|
20
20
|
// FUNCTIONS
|
|
21
21
|
|
|
22
22
|
// Scores the contact links of a type.
|
|
23
|
-
const contactScorer = (result, score,
|
|
23
|
+
const contactScorer = (result, score, linkProp, linkNameProp) => {
|
|
24
|
+
score[linkProp] = 2;
|
|
25
|
+
// If any of the links is named for accessibility:
|
|
24
26
|
const links = result.items;
|
|
25
27
|
if (links.some(
|
|
26
28
|
link => link.textContent.toLowerCase().includes('accessibility')
|
|
27
29
|
)) {
|
|
28
|
-
score[
|
|
30
|
+
score[linkNameProp] = 2;
|
|
29
31
|
}
|
|
32
|
+
// Otherwise, if the link context refers to accessibility:
|
|
30
33
|
else if (links.some(
|
|
31
34
|
link => link.parentTextContent.toLowerCase().includes('accessibility')
|
|
32
35
|
)) {
|
|
33
|
-
score[
|
|
36
|
+
score[linkNameProp] = 1;
|
|
34
37
|
}
|
|
35
38
|
};
|
|
36
39
|
// Scores a report.
|
|
@@ -38,67 +41,80 @@ exports.scorer = async report => {
|
|
|
38
41
|
const {acts} = report;
|
|
39
42
|
report.scoreProcID = scoreProcID;
|
|
40
43
|
report.score = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
pageLoad: 0,
|
|
45
|
+
pageFast: 0,
|
|
46
|
+
a11yLink: 0,
|
|
47
|
+
a11yLinkWork: 0,
|
|
48
|
+
a11yLinkFast: 0,
|
|
49
|
+
a11yPageTitle: 0,
|
|
50
|
+
a11yTitleGood: 0,
|
|
51
|
+
a11yPageH1: 0,
|
|
52
|
+
a11yH1Good: 0,
|
|
53
|
+
mailLink: 0,
|
|
54
|
+
mailLinkName: 0,
|
|
55
|
+
telLink: 0,
|
|
56
|
+
telLinkName: 0
|
|
47
57
|
};
|
|
48
58
|
const {score} = report;
|
|
49
59
|
if (Array.isArray(acts)) {
|
|
50
|
-
// Act 1: page
|
|
60
|
+
// Act 1: If the page loaded:
|
|
51
61
|
if (acts[1].result.startsWith('http')) {
|
|
52
|
-
score.
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
score.pageLoad = 2;
|
|
63
|
+
// If it loaded moderately fast:
|
|
64
|
+
const loadTime = acts[1].endTime - acts[1].startTime;
|
|
65
|
+
if (loadTime < 6000) {
|
|
66
|
+
score.pageFast = 1;
|
|
55
67
|
}
|
|
56
|
-
//
|
|
68
|
+
// If it loaded fast:
|
|
69
|
+
if (loadTime < 4000) {
|
|
70
|
+
score.pageFast = 2;
|
|
71
|
+
}
|
|
72
|
+
// Act 2: If the page has an accessibility link:
|
|
57
73
|
const {result} = acts[2];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// If it was clickable and the resulting load finished:
|
|
74
|
+
if (result.found) {
|
|
75
|
+
score.a11yLink = 1;
|
|
76
|
+
// If it works:
|
|
62
77
|
if (result.success) {
|
|
63
|
-
score.
|
|
64
|
-
// If the
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
score.a11yLinkWork = 2;
|
|
79
|
+
// If the resulting page loads fast:
|
|
80
|
+
const loadTime = acts[2].endTime - acts[2].startTime;
|
|
81
|
+
if (loadTime < 5000) {
|
|
82
|
+
score.a11yLinkFast = 1;
|
|
83
|
+
}
|
|
84
|
+
if (loadTime < 3000) {
|
|
85
|
+
score.a11yLinkFast = 2;
|
|
67
86
|
}
|
|
68
|
-
// Act 3:
|
|
87
|
+
// Act 3: If the resulting page has a title:
|
|
69
88
|
let {result} = acts[3];
|
|
70
89
|
if (result && result.success) {
|
|
71
|
-
score.
|
|
90
|
+
score.a11yPageTitle = 1;
|
|
91
|
+
// If it is an accessibility title:
|
|
72
92
|
if (result.title.toLowerCase().includes('accessibility')) {
|
|
73
|
-
score.
|
|
93
|
+
score.a11yTitleGood = 2;
|
|
74
94
|
}
|
|
75
95
|
}
|
|
76
|
-
// Act 4: page has
|
|
96
|
+
// Act 4: If the resulting page has a top heading:
|
|
77
97
|
result = acts[4].result;
|
|
78
98
|
if (result && result.total === 1) {
|
|
79
|
-
score.
|
|
99
|
+
score.a11yPageH1 = 1;
|
|
100
|
+
// If it is an accessibility heading:
|
|
80
101
|
if (result.items[0].textContent.toLowerCase().includes('accessibility')) {
|
|
81
|
-
score.
|
|
102
|
+
score.a11yH1Good = 2;
|
|
82
103
|
}
|
|
83
104
|
}
|
|
84
|
-
// Act 5: page has an accessibility email link
|
|
105
|
+
// Act 5: If the resulting page has an accessibility email link:
|
|
85
106
|
result = acts[5].result;
|
|
86
107
|
if (result.total) {
|
|
87
|
-
contactScorer(result, score, 'mailLink');
|
|
108
|
+
contactScorer(result, score, 'mailLink', 'mailLinkName');
|
|
88
109
|
}
|
|
89
|
-
// Act 6: page has accessibility telephone link
|
|
110
|
+
// Act 6: If the resulting page has accessibility telephone link:
|
|
90
111
|
result = acts[6].result;
|
|
91
112
|
if (result.total) {
|
|
92
|
-
contactScorer(result, score, 'telLink');
|
|
113
|
+
contactScorer(result, score, 'telLink', 'telLinkName');
|
|
93
114
|
}
|
|
94
115
|
}
|
|
95
116
|
}
|
|
96
117
|
}
|
|
97
118
|
}
|
|
98
|
-
score.total = score.
|
|
99
|
-
+ score.a11yLink
|
|
100
|
-
+ score.title
|
|
101
|
-
+ score.heading
|
|
102
|
-
+ score.mailLink
|
|
103
|
-
+ score.telLink;
|
|
119
|
+
score.total = Object.values(score).reduce((total, current) => total + current);
|
|
104
120
|
};
|