Skip to content

Commit 5c39157

Browse files
committed
feat: warn about doc-endnote or doc-biblioentry on list items
The roles `doc-endnote` and `doc-biblioentry` are deprecated in ARIA 1.1, and authors should not use them on list items. The HTML validator (validator.nu) raises an error when these roles are set on `li` elements. This commit implements a more permissive approach for EPUBCheck: - the roles are re-added the HTML schema - we raise a warning (RSC-017) when the roles are present on `li` elements
1 parent 2f6a2c7 commit 5c39157

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,5 +396,14 @@
396396
select="local-name(ancestor::$ancestor)"/> elements.</report>
397397
</rule>
398398
</pattern>
399+
400+
<pattern id="dpub-aria.doc-endnote.deprecated">
401+
<rule context="h:*[@role]">
402+
<report test="tokenize(@role,'\s+')='doc-endnote'"
403+
>WARNING: The "doc-endnote" role is deprecated and should not be used.</report>
404+
<report test="tokenize(@role,'\s+')='doc-biblioentry'"
405+
>WARNING: The "doc-biblioentry" role is deprecated and should not be used.</report>
406+
</rule>
407+
</pattern>
399408

400409
</schema>

src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/block.rnc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
| common.attrs.aria.role.treeitem
102102
| common.attrs.aria.role.separator
103103
| common.attrs.aria.role.presentation
104+
| common.attrs.aria.role.doc-biblioentry
105+
| common.attrs.aria.role.doc-endnote
104106
)?
105107
)
106108
li.inner =

src/test/resources/epub3/06-content-document/content-document-xhtml.feature

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,14 @@ Feature: EPUB 3 — Content Documents — XHTML
170170
When checking document 'aria-roles-img-valid.xhtml'
171171
Then no errors or warnings are reported
172172

173-
Scenario: Verify the DPUB-ARIA roles allowed on `li`
174-
When checking document 'aria-roles-li-valid.xhtml'
175-
Then no errors or warnings are reported
173+
Scenario: Report deprecated DPUB-ARIA roles on `li`
174+
When checking document 'aria-roles-li-deprecated-warning.xhtml'
175+
Then following warnings are reported:
176+
| RSC-017 | "doc-endnote" role is deprecated |
177+
| RSC-017 | "doc-endnote" role is deprecated |
178+
| RSC-017 | "doc-biblioentry" role is deprecated |
179+
| RSC-017 | "doc-biblioentry" role is deprecated |
180+
Then no other errors or warnings are reported
176181

177182
Scenario: Verify the DPUB-ARIA roles allowed on `nav`
178183
When checking document 'aria-roles-nav-valid.xhtml'

src/test/resources/epub3/06-content-document/files/aria-roles-li-valid.xhtml renamed to src/test/resources/epub3/06-content-document/files/aria-roles-li-deprecated-warning.xhtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111
<ol>
1212
<li role="doc-endnote"></li>
1313
</ol>
14+
<div role="list">
15+
<div role="doc-endnote">1.</div>
16+
</div>
1417
</section>
1518
<section role="doc-bibliography">
1619
<h2>Bibliography</h2>
1720
<ul>
1821
<li role="doc-biblioentry"></li>
1922
</ul>
23+
<div role="list">
24+
<div role="doc-biblioentry">1.</div>
25+
</div>
2026
</section>
2127
</body>
2228
</html>

0 commit comments

Comments
 (0)