From a3620504cdee09e9ca2e50527c2b8ed8b7a9ce6d Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Mon, 8 Jul 2019 15:18:15 +0200 Subject: [PATCH] fix: allow list items as children of roles inheriting from 'list' Fixes #239 --- .../ace-core/src/checker/checker-chromium.js | 1 + .../src/scripts/axe-patch-listitem.js | 32 +++++++++++++++++++ tests/__tests__/regression.test.js | 5 +++ tests/data/issue-239/EPUB/content_001.xhtml | 19 +++++++++++ tests/data/issue-239/EPUB/nav.xhtml | 12 +++++++ tests/data/issue-239/EPUB/package.opf | 23 +++++++++++++ tests/data/issue-239/META-INF/container.xml | 6 ++++ tests/data/issue-239/mimetype | 1 + 8 files changed, 99 insertions(+) create mode 100644 packages/ace-core/src/scripts/axe-patch-listitem.js create mode 100644 tests/data/issue-239/EPUB/content_001.xhtml create mode 100644 tests/data/issue-239/EPUB/nav.xhtml create mode 100644 tests/data/issue-239/EPUB/package.opf create mode 100644 tests/data/issue-239/META-INF/container.xml create mode 100644 tests/data/issue-239/mimetype diff --git a/packages/ace-core/src/checker/checker-chromium.js b/packages/ace-core/src/checker/checker-chromium.js index dec2e53c..98fc7a4f 100644 --- a/packages/ace-core/src/checker/checker-chromium.js +++ b/packages/ace-core/src/checker/checker-chromium.js @@ -19,6 +19,7 @@ const scripts = [ require.resolve('../scripts/axe-patch-aria-roles.js'), require.resolve('../scripts/axe-patch-is-aria-role-allowed.js'), require.resolve('../scripts/axe-patch-only-list-items.js'), + require.resolve('../scripts/axe-patch-listitem.js'), require.resolve('../scripts/ace-axe.js'), require.resolve('../scripts/ace-extraction.js'), ]; diff --git a/packages/ace-core/src/scripts/axe-patch-listitem.js b/packages/ace-core/src/scripts/axe-patch-listitem.js new file mode 100644 index 00000000..f82e6b44 --- /dev/null +++ b/packages/ace-core/src/scripts/axe-patch-listitem.js @@ -0,0 +1,32 @@ +'use strict'; + +/* +This patch is needed to ensure that roles *inheriting* a list role are allowed +as listitem parents. +E.g. `