Skip to content

Commit

Permalink
fix(core): headings with role doc-subtitle reported empty
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
rdeltour committed May 18, 2018
1 parent ffb262c commit 4a15b44
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 31 deletions.
62 changes: 31 additions & 31 deletions packages/ace-core/src/scripts/axe-patch-arialookuptable.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-colophon': {
Expand All @@ -90,7 +90,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-conclusion': {
Expand All @@ -99,7 +99,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-cover': {
Expand All @@ -108,7 +108,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-credit': {
Expand All @@ -117,7 +117,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-credits': {
Expand All @@ -126,7 +126,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-dedication': {
Expand All @@ -135,7 +135,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-endnote': {
Expand All @@ -144,7 +144,7 @@
allowed: ['aria-expanded', 'aria-level', 'aria-posinset', 'aria-setsize'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: ['doc-endnotes'],
},
'doc-endnotes': {
Expand All @@ -153,7 +153,7 @@
allowed: ['aria-expanded'],
},
owned: ['doc-endnote'],
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-epigraph': {
Expand All @@ -162,7 +162,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-epilogue': {
Expand All @@ -171,7 +171,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-errata': {
Expand All @@ -180,7 +180,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-example': {
Expand All @@ -189,7 +189,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-footnote': {
Expand All @@ -198,7 +198,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-foreword': {
Expand All @@ -207,7 +207,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-glossary': {
Expand All @@ -216,7 +216,7 @@
allowed: ['aria-expanded'],
},
owned: ['term', 'definition'],
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-glossref': {
Expand All @@ -225,7 +225,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author', 'contents'],
nameFrom: ['author', 'contents'],
context: null,
},
'doc-index': {
Expand All @@ -234,7 +234,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-introduction': {
Expand All @@ -243,7 +243,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-noteref': {
Expand All @@ -252,7 +252,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author', 'contents'],
nameFrom: ['author', 'contents'],
context: null,
},
'doc-notice': {
Expand All @@ -261,7 +261,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-pagebreak': {
Expand All @@ -270,7 +270,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-pagelist': {
Expand All @@ -279,7 +279,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-part': {
Expand All @@ -288,7 +288,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-preface': {
Expand All @@ -297,7 +297,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-prologue': {
Expand All @@ -306,7 +306,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-pullquote': {
Expand All @@ -315,7 +315,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-qna': {
Expand All @@ -324,7 +324,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-subtitle': {
Expand All @@ -333,7 +333,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author', 'contents'],
context: null,
},
'doc-tip': {
Expand All @@ -342,7 +342,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
'doc-toc': {
Expand All @@ -351,7 +351,7 @@
allowed: ['aria-expanded'],
},
owned: null,
namefrom: ['author'],
nameFrom: ['author'],
context: null,
},
};
Expand Down
5 changes: 5 additions & 0 deletions tests/__tests__/regression.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ test('issue #122: Failed to check HTML content with `.xml` extension', async ()
const report = await ace('../data/issue-122');
expect(report['earl:result']['earl:outcome']).toEqual('pass');
});

test('issue #170: heading with `doc-subtitle` role were reported empty', async () => {
const report = await ace('../data/issue-170');
expect(report['earl:result']['earl:outcome']).toEqual('pass');
});
9 changes: 9 additions & 0 deletions tests/data/issue-170/EPUB/content_001.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<title>Minimal EPUB</title>
</head>
<body>
<h1 epub:type="subtitle" role="doc-subtitle">Loomings</h1>
<p>Call me Ishmael.</p>
</body>
</html>
12 changes: 12 additions & 0 deletions tests/data/issue-170/EPUB/nav.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<title>Minimal Nav</title>
</head>
<body>
<nav epub:type="toc">
<ol>
<li><a href="content_001.xhtml">content 001</a></li>
</ol>
</nav>
</body>
</html>
23 changes: 23 additions & 0 deletions tests/data/issue-170/EPUB/package.opf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="uid">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title id="title">Minimal EPUB 3.0</dc:title>
<dc:language>en</dc:language>
<dc:identifier id="uid">NOID</dc:identifier>
<meta property="dcterms:modified">2017-01-01T00:00:01Z</meta>
<meta property="schema:accessibilityFeature">structuralNavigation</meta>
<meta property="schema:accessibilitySummary">everything OK!</meta>
<meta property="schema:accessibilityHazard">noFlashingHazard</meta>
<meta property="schema:accessibilityHazard">noSoundHazard</meta>
<meta property="schema:accessibilityHazard">noMotionSimulationHazard</meta>
<meta property="schema:accessMode">textual</meta>
<meta property="schema:accessModeSufficient">textual</meta>
</metadata>
<manifest>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/>
</manifest>
<spine>
<itemref idref="content_001" />
</spine>
</package>
6 changes: 6 additions & 0 deletions tests/data/issue-170/META-INF/container.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
1 change: 1 addition & 0 deletions tests/data/issue-170/mimetype
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
application/epub+zip

0 comments on commit 4a15b44

Please sign in to comment.