From a606bd70d53123fd146f69d3df4cc5234238e1d7 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 ++ .../06-content-document/content-document-xhtml.feature | 9 ++++++--- ...alid.xhtml => aria-roles-li-deprecated-warning.xhtml} | 0 4 files changed, 17 insertions(+), 3 deletions(-) rename src/test/resources/epub3/06-content-document/files/{aria-roles-li-valid.xhtml => aria-roles-li-deprecated-warning.xhtml} (100%) 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..59f530420 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 should not be used on list item elements (deprecated in DPUB ARIA 1.1). + WARNING: The "doc-biblioentry" role should not be used on list item elements (deprecated in DPUB ARIA 1.1). + + 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..1f1be1967 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,12 @@ 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 should not be used on list item | + | RSC-017 | "doc-biblioentry" role should not be used on list item | + 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 100% 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