diff --git a/packages/ace-core/src/scripts/ace-axe.js b/packages/ace-core/src/scripts/ace-axe.js index 97677ad1..fb86f1ee 100644 --- a/packages/ace-core/src/scripts/ace-axe.js +++ b/packages/ace-core/src/scripts/ace-axe.js @@ -175,6 +175,7 @@ daisy.ace.run = function(done) { selector: '[*|type]', any: ['matching-aria-role'], metadata: { + help: "ARIA role should be used in addition to epub:type", description: "Ensure the element has an ARIA role matching its epub:type", }, tags: ['best-practice'] diff --git a/packages/ace-report-axe/src/index.js b/packages/ace-report-axe/src/index.js index 81cad5a4..0331bbec 100644 --- a/packages/ace-report-axe/src/index.js +++ b/packages/ace-report-axe/src/index.js @@ -9,57 +9,58 @@ const winston = require('winston'); const kbMap = { 'baseUrl': 'http://kb.daisy.org/publishing/', 'map': { - 'pagebreak-label': {url: 'docs/navigation/pagelist.html', 'title': 'Page Breaks'}, - 'html-has-lang': {url: 'docs/html/lang.html', title: 'Language'}, - 'html-lang-valid': {url: 'docs/html/lang.html', title: 'Language'}, - 'valid-lang': {url: 'docs/html/lang.html', title: 'Language'}, + 'accesskeys': {url: 'docs/html/accesskeys.html', title: 'Access Keys'}, 'area-alt': {url: 'docs/html/maps.html', title: 'Image Maps'}, - 'server-side-image-map': {url: 'docs/html/maps.html', title: 'Image Maps'}, - 'list': {url: 'docs/html/lists.html', title: 'Lists'}, - 'listitem': {url: 'docs/html/lists.html', title: 'Lists'}, - 'definition-list': {url: 'docs/html/lists.html', title: 'Lists'}, - 'dlitem': {url: 'docs/html/lists.html', title: 'Lists'}, - 'video-caption': {url: 'docs/html/video.html', title: 'Video'}, - 'video-description': {url: 'docs/html/video.html', title: 'Video'}, - 'table-duplicate-name': {url: 'docs/html/tables.html', title: 'Tables'}, - 'table-fake-caption': {url: 'docs/html/tables.html', title: 'Tables'}, - 'td-has-header': {url: 'docs/html/tables.html', title: 'Tables'}, - 'td-headers-attr': {url: 'docs/html/tables.html', title: 'Tables'}, - 'th-has-data-cells': {url: 'docs/html/tables.html', title: 'Tables'}, - 'layout-table': {url: 'docs/html/tables.html', title: 'Tables'}, - 'scope-attr-valid': {url: 'docs/html/tables.html', title: 'Tables'}, - 'image-alt': {url: 'docs/html/images.html', title: 'Images'}, - 'image-redundant-alt': {url: 'docs/html/images.html', title: 'Images'}, - 'input-image-alt': {url: 'docs/html/images.html', title: 'Images'}, - 'frame-title-unique': {url: 'docs/html/iframes.html', title: 'Inline Frames'}, - 'frame-title': {url: 'docs/html/iframes.html', title: 'Inline Frames'}, - 'meta-refresh': {url: 'docs/html/meta.html', title: 'Meta'}, - 'meta-viewport-large': {url: 'docs/html/meta.html', title: 'Meta'}, - 'meta-viewport': {url: 'docs/html/meta.html', title: 'Meta'}, 'aria-allowed-attr': {url: 'docs/script/aria.html', title: 'ARIA'}, + 'aria-hidden-body': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-required-attr': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-required-children': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-required-parent': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-roles': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-valid-attr-value': {url: 'docs/script/aria.html', title: 'ARIA'}, 'aria-valid-attr': {url: 'docs/script/aria.html', title: 'ARIA'}, - 'aria-hidden-body': {url: 'docs/script/aria.html', title: 'ARIA'}, - 'empty-heading': {url: 'docs/html/headings.html', title: 'Headings'}, - 'heading-order': {url: 'docs/html/headings.html', title: 'Headings'}, - 'p-as-heading': {url: 'docs/html/headings.html', title: 'Headings'}, + 'button-name': {url: 'docs/html/forms.html', title: 'Forms'}, + 'checkboxgroup': {url: 'docs/html/forms.html', title: 'Forms'}, + 'color-contrast': {url: 'docs/css/color.html', title: 'Color'}, + 'definition-list': {url: 'docs/html/lists.html', title: 'Lists'}, + 'dlitem': {url: 'docs/html/lists.html', title: 'Lists'}, 'document-title': {url: 'docs/html/title.html', title: 'Page Title'}, 'duplicate-id': {url: 'docs/html/ids.html', title: 'Identifiers'}, - 'radiogroup': {url: 'docs/html/forms.html', title: 'Forms'}, - 'checkboxgroup': {url: 'docs/html/forms.html', title: 'Forms'}, + 'empty-heading': {url: 'docs/html/headings.html', title: 'Headings'}, + 'epub-type-has-matching-role': {url: 'docs/html/roles.html', title: 'ARIA role'}, + 'frame-title-unique': {url: 'docs/html/iframes.html', title: 'Inline Frames'}, + 'frame-title': {url: 'docs/html/iframes.html', title: 'Inline Frames'}, + 'heading-order': {url: 'docs/html/headings.html', title: 'Headings'}, + 'href-no-hash': {url: 'docs/html/links.html', title: 'Links'}, + 'html-has-lang': {url: 'docs/html/lang.html', title: 'Language'}, + 'html-lang-valid': {url: 'docs/html/lang.html', title: 'Language'}, + 'image-alt': {url: 'docs/html/images.html', title: 'Images'}, + 'image-redundant-alt': {url: 'docs/html/images.html', title: 'Images'}, + 'input-image-alt': {url: 'docs/html/images.html', title: 'Images'}, 'label-title-only': {url: 'docs/html/forms.html', title: 'Forms'}, 'label': {url: 'docs/html/forms.html', title: 'Forms'}, - 'button-name': {url: 'docs/html/forms.html', title: 'Forms'}, - 'accesskeys': {url: 'docs/html/accesskeys.html', title: 'Access Keys'}, - 'color-contrast': {url: 'docs/css/color.html', title: 'Color'}, + 'layout-table': {url: 'docs/html/tables.html', title: 'Tables'}, 'link-in-text-block': {url: 'docs/html/links.html', title: 'Links'}, 'link-name': {url: 'docs/html/links.html', title: 'Links'}, - 'href-no-hash': {url: 'docs/html/links.html', title: 'Links'}, - 'object-alt': {url: 'docs/html/object.html', title: 'Object'} + 'list': {url: 'docs/html/lists.html', title: 'Lists'}, + 'listitem': {url: 'docs/html/lists.html', title: 'Lists'}, + 'meta-refresh': {url: 'docs/html/meta.html', title: 'Meta'}, + 'meta-viewport-large': {url: 'docs/html/meta.html', title: 'Meta'}, + 'meta-viewport': {url: 'docs/html/meta.html', title: 'Meta'}, + 'object-alt': {url: 'docs/html/object.html', title: 'Object'}, + 'p-as-heading': {url: 'docs/html/headings.html', title: 'Headings'}, + 'pagebreak-label': {url: 'docs/navigation/pagelist.html', 'title': 'Page Breaks'}, + 'radiogroup': {url: 'docs/html/forms.html', title: 'Forms'}, + 'scope-attr-valid': {url: 'docs/html/tables.html', title: 'Tables'}, + 'server-side-image-map': {url: 'docs/html/maps.html', title: 'Image Maps'}, + 'table-duplicate-name': {url: 'docs/html/tables.html', title: 'Tables'}, + 'table-fake-caption': {url: 'docs/html/tables.html', title: 'Tables'}, + 'td-has-header': {url: 'docs/html/tables.html', title: 'Tables'}, + 'td-headers-attr': {url: 'docs/html/tables.html', title: 'Tables'}, + 'th-has-data-cells': {url: 'docs/html/tables.html', title: 'Tables'}, + 'valid-lang': {url: 'docs/html/lang.html', title: 'Language'}, + 'video-caption': {url: 'docs/html/video.html', title: 'Video'}, + 'video-description': {url: 'docs/html/video.html', title: 'Video'}, } }; diff --git a/tests/__tests__/axe-rules.test.js b/tests/__tests__/axe-rules.test.js index d8a48116..59977c31 100644 --- a/tests/__tests__/axe-rules.test.js +++ b/tests/__tests__/axe-rules.test.js @@ -102,10 +102,14 @@ test('Checks that `epub:type` have matching ARIA roles', async() => { expect(assertions).toBeDefined(); expect(assertions).toEqual(expect.arrayContaining([ expect.objectContaining({ - 'earl:test': expect.objectContaining({ 'dct:title': 'epub-type-has-matching-role' }), - 'earl:result': expect.objectContaining({ - 'earl:outcome': 'fail', - 'earl:pointer': expect.objectContaining({ css: ['#fail1'] }), + 'earl:test': expect.objectContaining({ + 'dct:title': 'epub-type-has-matching-role', + 'dct:description': 'Ensure the element has an ARIA role matching its epub:type', + 'help': { + 'url': 'http://kb.daisy.org/publishing/docs/html/roles.html', + 'title': 'ARIA role', + 'description': 'ARIA role should be used in addition to epub:type' + } }), }), expect.objectContaining({