Skip to content

Commit 7ad1373

Browse files
committed
fix(core): headings with role doc-subtitle reported empty
- Allow the accessible name of role `doc-subtitle` to be computed from the element’s contents (in axe’s ARIA lookup table) see also w3c/dpub-aria#6 - Fix the case of field `nameFrom` in the DPUB ARIA lookup table - Add a regression test
1 parent 4a7d88f commit 7ad1373

File tree

7 files changed

+87
-31
lines changed

7 files changed

+87
-31
lines changed

packages/ace-core/src/scripts/axe-patch-arialookuptable.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
allowed: ['aria-expanded'],
8282
},
8383
owned: null,
84-
namefrom: ['author'],
84+
nameFrom: ['author'],
8585
context: null,
8686
},
8787
'doc-colophon': {
@@ -90,7 +90,7 @@
9090
allowed: ['aria-expanded'],
9191
},
9292
owned: null,
93-
namefrom: ['author'],
93+
nameFrom: ['author'],
9494
context: null,
9595
},
9696
'doc-conclusion': {
@@ -99,7 +99,7 @@
9999
allowed: ['aria-expanded'],
100100
},
101101
owned: null,
102-
namefrom: ['author'],
102+
nameFrom: ['author'],
103103
context: null,
104104
},
105105
'doc-cover': {
@@ -108,7 +108,7 @@
108108
allowed: ['aria-expanded'],
109109
},
110110
owned: null,
111-
namefrom: ['author'],
111+
nameFrom: ['author'],
112112
context: null,
113113
},
114114
'doc-credit': {
@@ -117,7 +117,7 @@
117117
allowed: ['aria-expanded'],
118118
},
119119
owned: null,
120-
namefrom: ['author'],
120+
nameFrom: ['author'],
121121
context: null,
122122
},
123123
'doc-credits': {
@@ -126,7 +126,7 @@
126126
allowed: ['aria-expanded'],
127127
},
128128
owned: null,
129-
namefrom: ['author'],
129+
nameFrom: ['author'],
130130
context: null,
131131
},
132132
'doc-dedication': {
@@ -135,7 +135,7 @@
135135
allowed: ['aria-expanded'],
136136
},
137137
owned: null,
138-
namefrom: ['author'],
138+
nameFrom: ['author'],
139139
context: null,
140140
},
141141
'doc-endnote': {
@@ -144,7 +144,7 @@
144144
allowed: ['aria-expanded', 'aria-level', 'aria-posinset', 'aria-setsize'],
145145
},
146146
owned: null,
147-
namefrom: ['author'],
147+
nameFrom: ['author'],
148148
context: ['doc-endnotes'],
149149
},
150150
'doc-endnotes': {
@@ -153,7 +153,7 @@
153153
allowed: ['aria-expanded'],
154154
},
155155
owned: ['doc-endnote'],
156-
namefrom: ['author'],
156+
nameFrom: ['author'],
157157
context: null,
158158
},
159159
'doc-epigraph': {
@@ -162,7 +162,7 @@
162162
allowed: ['aria-expanded'],
163163
},
164164
owned: null,
165-
namefrom: ['author'],
165+
nameFrom: ['author'],
166166
context: null,
167167
},
168168
'doc-epilogue': {
@@ -171,7 +171,7 @@
171171
allowed: ['aria-expanded'],
172172
},
173173
owned: null,
174-
namefrom: ['author'],
174+
nameFrom: ['author'],
175175
context: null,
176176
},
177177
'doc-errata': {
@@ -180,7 +180,7 @@
180180
allowed: ['aria-expanded'],
181181
},
182182
owned: null,
183-
namefrom: ['author'],
183+
nameFrom: ['author'],
184184
context: null,
185185
},
186186
'doc-example': {
@@ -189,7 +189,7 @@
189189
allowed: ['aria-expanded'],
190190
},
191191
owned: null,
192-
namefrom: ['author'],
192+
nameFrom: ['author'],
193193
context: null,
194194
},
195195
'doc-footnote': {
@@ -198,7 +198,7 @@
198198
allowed: ['aria-expanded'],
199199
},
200200
owned: null,
201-
namefrom: ['author'],
201+
nameFrom: ['author'],
202202
context: null,
203203
},
204204
'doc-foreword': {
@@ -207,7 +207,7 @@
207207
allowed: ['aria-expanded'],
208208
},
209209
owned: null,
210-
namefrom: ['author'],
210+
nameFrom: ['author'],
211211
context: null,
212212
},
213213
'doc-glossary': {
@@ -216,7 +216,7 @@
216216
allowed: ['aria-expanded'],
217217
},
218218
owned: ['term', 'definition'],
219-
namefrom: ['author'],
219+
nameFrom: ['author'],
220220
context: null,
221221
},
222222
'doc-glossref': {
@@ -225,7 +225,7 @@
225225
allowed: ['aria-expanded'],
226226
},
227227
owned: null,
228-
namefrom: ['author', 'contents'],
228+
nameFrom: ['author', 'contents'],
229229
context: null,
230230
},
231231
'doc-index': {
@@ -234,7 +234,7 @@
234234
allowed: ['aria-expanded'],
235235
},
236236
owned: null,
237-
namefrom: ['author'],
237+
nameFrom: ['author'],
238238
context: null,
239239
},
240240
'doc-introduction': {
@@ -243,7 +243,7 @@
243243
allowed: ['aria-expanded'],
244244
},
245245
owned: null,
246-
namefrom: ['author'],
246+
nameFrom: ['author'],
247247
context: null,
248248
},
249249
'doc-noteref': {
@@ -252,7 +252,7 @@
252252
allowed: ['aria-expanded'],
253253
},
254254
owned: null,
255-
namefrom: ['author', 'contents'],
255+
nameFrom: ['author', 'contents'],
256256
context: null,
257257
},
258258
'doc-notice': {
@@ -261,7 +261,7 @@
261261
allowed: ['aria-expanded'],
262262
},
263263
owned: null,
264-
namefrom: ['author'],
264+
nameFrom: ['author'],
265265
context: null,
266266
},
267267
'doc-pagebreak': {
@@ -270,7 +270,7 @@
270270
allowed: ['aria-expanded'],
271271
},
272272
owned: null,
273-
namefrom: ['author'],
273+
nameFrom: ['author'],
274274
context: null,
275275
},
276276
'doc-pagelist': {
@@ -279,7 +279,7 @@
279279
allowed: ['aria-expanded'],
280280
},
281281
owned: null,
282-
namefrom: ['author'],
282+
nameFrom: ['author'],
283283
context: null,
284284
},
285285
'doc-part': {
@@ -288,7 +288,7 @@
288288
allowed: ['aria-expanded'],
289289
},
290290
owned: null,
291-
namefrom: ['author'],
291+
nameFrom: ['author'],
292292
context: null,
293293
},
294294
'doc-preface': {
@@ -297,7 +297,7 @@
297297
allowed: ['aria-expanded'],
298298
},
299299
owned: null,
300-
namefrom: ['author'],
300+
nameFrom: ['author'],
301301
context: null,
302302
},
303303
'doc-prologue': {
@@ -306,7 +306,7 @@
306306
allowed: ['aria-expanded'],
307307
},
308308
owned: null,
309-
namefrom: ['author'],
309+
nameFrom: ['author'],
310310
context: null,
311311
},
312312
'doc-pullquote': {
@@ -315,7 +315,7 @@
315315
allowed: ['aria-expanded'],
316316
},
317317
owned: null,
318-
namefrom: ['author'],
318+
nameFrom: ['author'],
319319
context: null,
320320
},
321321
'doc-qna': {
@@ -324,7 +324,7 @@
324324
allowed: ['aria-expanded'],
325325
},
326326
owned: null,
327-
namefrom: ['author'],
327+
nameFrom: ['author'],
328328
context: null,
329329
},
330330
'doc-subtitle': {
@@ -333,7 +333,7 @@
333333
allowed: ['aria-expanded'],
334334
},
335335
owned: null,
336-
namefrom: ['author'],
336+
nameFrom: ['author', 'contents'],
337337
context: null,
338338
},
339339
'doc-tip': {
@@ -342,7 +342,7 @@
342342
allowed: ['aria-expanded'],
343343
},
344344
owned: null,
345-
namefrom: ['author'],
345+
nameFrom: ['author'],
346346
context: null,
347347
},
348348
'doc-toc': {
@@ -351,7 +351,7 @@
351351
allowed: ['aria-expanded'],
352352
},
353353
owned: null,
354-
namefrom: ['author'],
354+
nameFrom: ['author'],
355355
context: null,
356356
},
357357
};

tests/__tests__/regression.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ test('issue #122: Failed to check HTML content with `.xml` extension', async ()
7070
const report = await ace('../data/issue-122');
7171
expect(report['earl:result']['earl:outcome']).toEqual('pass');
7272
});
73+
74+
test('issue #170: heading with `doc-subtitle` role were reported empty', async () => {
75+
const report = await ace('../data/issue-170');
76+
expect(report['earl:result']['earl:outcome']).toEqual('pass');
77+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
2+
<head>
3+
<title>Minimal EPUB</title>
4+
</head>
5+
<body>
6+
<h1 epub:type="subtitle" role="doc-subtitle">Loomings</h1>
7+
<p>Call me Ishmael.</p>
8+
</body>
9+
</html>

tests/data/issue-170/EPUB/nav.xhtml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
2+
<head>
3+
<title>Minimal Nav</title>
4+
</head>
5+
<body>
6+
<nav epub:type="toc">
7+
<ol>
8+
<li><a href="content_001.xhtml">content 001</a></li>
9+
</ol>
10+
</nav>
11+
</body>
12+
</html>

tests/data/issue-170/EPUB/package.opf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="uid">
3+
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
4+
<dc:title id="title">Minimal EPUB 3.0</dc:title>
5+
<dc:language>en</dc:language>
6+
<dc:identifier id="uid">NOID</dc:identifier>
7+
<meta property="dcterms:modified">2017-01-01T00:00:01Z</meta>
8+
<meta property="schema:accessibilityFeature">structuralNavigation</meta>
9+
<meta property="schema:accessibilitySummary">everything OK!</meta>
10+
<meta property="schema:accessibilityHazard">noFlashingHazard</meta>
11+
<meta property="schema:accessibilityHazard">noSoundHazard</meta>
12+
<meta property="schema:accessibilityHazard">noMotionSimulationHazard</meta>
13+
<meta property="schema:accessMode">textual</meta>
14+
<meta property="schema:accessModeSufficient">textual</meta>
15+
</metadata>
16+
<manifest>
17+
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
18+
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/>
19+
</manifest>
20+
<spine>
21+
<itemref idref="content_001" />
22+
</spine>
23+
</package>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
3+
<rootfiles>
4+
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/>
5+
</rootfiles>
6+
</container>

tests/data/issue-170/mimetype

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
application/epub+zip

0 commit comments

Comments
 (0)