From 5c391579050f1875c3232d0546412529ed581ce8 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Fri, 7 Jul 2023 11:26:11 +0200 Subject: [PATCH] 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 --- .../com/adobe/epubcheck/schema/30/epub-xhtml-30.sch | 9 +++++++++ .../com/adobe/epubcheck/schema/30/mod/html5/block.rnc | 2 ++ .../content-document-xhtml.feature | 11 ++++++++--- ...d.xhtml => aria-roles-li-deprecated-warning.xhtml} | 6 ++++++ 4 files changed, 25 insertions(+), 3 deletions(-) rename src/test/resources/epub3/06-content-document/files/{aria-roles-li-valid.xhtml => aria-roles-li-deprecated-warning.xhtml} (76%) diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch index 4b967b85d..d1db0b6ed 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch @@ -396,5 +396,14 @@ select="local-name(ancestor::$ancestor)"/> elements. + + + + WARNING: The "doc-endnote" role is deprecated and should not be used. + WARNING: The "doc-biblioentry" role is deprecated and should not be used. + + diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/block.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/block.rnc index 0bae92579..714531882 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/block.rnc +++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/block.rnc @@ -101,6 +101,8 @@ | common.attrs.aria.role.treeitem | common.attrs.aria.role.separator | common.attrs.aria.role.presentation + | common.attrs.aria.role.doc-biblioentry + | common.attrs.aria.role.doc-endnote )? ) li.inner = diff --git a/src/test/resources/epub3/06-content-document/content-document-xhtml.feature b/src/test/resources/epub3/06-content-document/content-document-xhtml.feature index 69019ed35..c417d939e 100644 --- a/src/test/resources/epub3/06-content-document/content-document-xhtml.feature +++ b/src/test/resources/epub3/06-content-document/content-document-xhtml.feature @@ -170,9 +170,14 @@ Feature: EPUB 3 — Content Documents — XHTML When checking document 'aria-roles-img-valid.xhtml' Then no errors or warnings are reported - Scenario: Verify the DPUB-ARIA roles allowed on `li` - When checking document 'aria-roles-li-valid.xhtml' - Then no errors or warnings are reported + Scenario: Report deprecated DPUB-ARIA roles on `li` + When checking document 'aria-roles-li-deprecated-warning.xhtml' + Then following warnings are reported: + | RSC-017 | "doc-endnote" role is deprecated | + | RSC-017 | "doc-endnote" role is deprecated | + | RSC-017 | "doc-biblioentry" role is deprecated | + | RSC-017 | "doc-biblioentry" role is deprecated | + Then no other errors or warnings are reported Scenario: Verify the DPUB-ARIA roles allowed on `nav` When checking document 'aria-roles-nav-valid.xhtml' diff --git a/src/test/resources/epub3/06-content-document/files/aria-roles-li-valid.xhtml b/src/test/resources/epub3/06-content-document/files/aria-roles-li-deprecated-warning.xhtml similarity index 76% rename from src/test/resources/epub3/06-content-document/files/aria-roles-li-valid.xhtml rename to src/test/resources/epub3/06-content-document/files/aria-roles-li-deprecated-warning.xhtml index 2c1e62d20..3538ab5f8 100644 --- a/src/test/resources/epub3/06-content-document/files/aria-roles-li-valid.xhtml +++ b/src/test/resources/epub3/06-content-document/files/aria-roles-li-deprecated-warning.xhtml @@ -11,12 +11,18 @@
+
+
1.
+

Bibliography

+
+
1.
+