Skip to content

Commit

Permalink
feat: warn about doc-endnote or doc-biblioentry on list items
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rdeltour committed Jul 7, 2023
1 parent 2f6a2c7 commit a606bd7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,14 @@
select="local-name(ancestor::$ancestor)"/> elements.</report>
</rule>
</pattern>

<pattern id="dpub-aria.doc-endnote.deprecated">
<rule context="h:li">
<report test="tokenize(@role,'\s+')='doc-endnote'"
>WARNING: The "doc-endnote" role should not be used on list item elements (deprecated in DPUB ARIA 1.1).</report>
<report test="tokenize(@role,'\s+')='doc-biblioentry'"
>WARNING: The "doc-biblioentry" role should not be used on list item elements (deprecated in DPUB ARIA 1.1).</report>
</rule>
</pattern>

</schema>
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit a606bd7

Please sign in to comment.