govuk_publishing_components 16.6.0 → 16.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/component_guide/accessibility-test.js +6 -12
- data/app/assets/javascripts/component_guide/vendor/bind-polyfill.js +8 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +16 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss +1 -27
- data/app/views/govuk_publishing_components/components/_fieldset.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_input.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/docs/input.yml +7 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/axe-core/CHANGELOG.md +741 -0
- data/node_modules/axe-core/CONTRIBUTING.md +187 -0
- data/node_modules/axe-core/LICENSE +362 -0
- data/node_modules/axe-core/README.md +147 -0
- data/node_modules/axe-core/axe.d.ts +216 -0
- data/node_modules/axe-core/axe.js +15298 -0
- data/node_modules/axe-core/axe.min.js +12 -0
- data/node_modules/axe-core/bower.json +40 -0
- data/node_modules/axe-core/doc/API.md +798 -0
- data/node_modules/axe-core/doc/accessibility-supported.md +33 -0
- data/node_modules/axe-core/doc/act-rules-format.md +37 -0
- data/node_modules/axe-core/doc/aria-supported.md +23 -0
- data/node_modules/axe-core/doc/axelogo2018.png +0 -0
- data/node_modules/axe-core/doc/code-submission-guidelines.md +178 -0
- data/node_modules/axe-core/doc/developer-guide.md +500 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/README.md +13 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/axe-cdp.js +81 -0
- data/node_modules/axe-core/doc/examples/chrome-debugging-protocol/package.json +8 -0
- data/node_modules/axe-core/doc/examples/html-handlebars.md +164 -0
- data/node_modules/axe-core/doc/examples/jasmine/README.md +37 -0
- data/node_modules/axe-core/doc/examples/jasmine/package.json +20 -0
- data/node_modules/axe-core/doc/examples/jasmine/spec/a11y.js +36 -0
- data/node_modules/axe-core/doc/examples/jest_react/README.md +41 -0
- data/node_modules/axe-core/doc/examples/jest_react/link.js +7 -0
- data/node_modules/axe-core/doc/examples/jest_react/link.test.js +24 -0
- data/node_modules/axe-core/doc/examples/jest_react/package.json +28 -0
- data/node_modules/axe-core/doc/examples/jest_react/test-helpers.js +21 -0
- data/node_modules/axe-core/doc/examples/mocha/README.md +37 -0
- data/node_modules/axe-core/doc/examples/mocha/package.json +21 -0
- data/node_modules/axe-core/doc/examples/phantomjs/README.md +17 -0
- data/node_modules/axe-core/doc/examples/phantomjs/axe-phantom.js +51 -0
- data/node_modules/axe-core/doc/examples/phantomjs/package.json +19 -0
- data/node_modules/axe-core/doc/examples/puppeteer/README.md +12 -0
- data/node_modules/axe-core/doc/examples/puppeteer/axe-puppeteer.js +60 -0
- data/node_modules/axe-core/doc/examples/puppeteer/package.json +10 -0
- data/node_modules/axe-core/doc/examples/qunit/README.md +37 -0
- data/node_modules/axe-core/doc/examples/qunit/package.json +21 -0
- data/node_modules/axe-core/doc/plugins.md +123 -0
- data/node_modules/axe-core/doc/projects.md +44 -0
- data/node_modules/axe-core/doc/rule-descriptions.md +79 -0
- data/node_modules/axe-core/doc/rule-development.md +95 -0
- data/node_modules/axe-core/doc/rule-proposal.md +106 -0
- data/node_modules/axe-core/lib/checks/aria/abstractrole.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/abstractrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/allowed-attr.js +39 -0
- data/node_modules/axe-core/lib/checks/aria/allowed-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/aria-allowed-role.js +28 -0
- data/node_modules/axe-core/lib/checks/aria/aria-allowed-role.json +16 -0
- data/node_modules/axe-core/lib/checks/aria/aria-hidden-body.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/aria-hidden-body.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/errormessage.js +33 -0
- data/node_modules/axe-core/lib/checks/aria/errormessage.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/has-widget-role.js +6 -0
- data/node_modules/axe-core/lib/checks/aria/has-widget-role.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/implicit-role-fallback.js +6 -0
- data/node_modules/axe-core/lib/checks/aria/implicit-role-fallback.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/invalidrole.js +3 -0
- data/node_modules/axe-core/lib/checks/aria/invalidrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/required-attr.js +28 -0
- data/node_modules/axe-core/lib/checks/aria/required-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/required-children.js +117 -0
- data/node_modules/axe-core/lib/checks/aria/required-children.json +15 -0
- data/node_modules/axe-core/lib/checks/aria/required-parent.js +87 -0
- data/node_modules/axe-core/lib/checks/aria/required-parent.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedattr.js +39 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedattr.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedrole.js +1 -0
- data/node_modules/axe-core/lib/checks/aria/unsupportedrole.json +11 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr-value.js +32 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr-value.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr.js +25 -0
- data/node_modules/axe-core/lib/checks/aria/valid-attr.json +12 -0
- data/node_modules/axe-core/lib/checks/aria/valid-scrollable-semantics.js +62 -0
- data/node_modules/axe-core/lib/checks/aria/valid-scrollable-semantics.json +12 -0
- data/node_modules/axe-core/lib/checks/color/color-contrast.js +70 -0
- data/node_modules/axe-core/lib/checks/color/color-contrast.json +24 -0
- data/node_modules/axe-core/lib/checks/color/link-in-text-block.js +85 -0
- data/node_modules/axe-core/lib/checks/color/link-in-text-block.json +19 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-appropriate.js +67 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-appropriate.json +11 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-valid.js +2 -0
- data/node_modules/axe-core/lib/checks/forms/autocomplete-valid.json +11 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset-after.js +25 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset.js +109 -0
- data/node_modules/axe-core/lib/checks/forms/fieldset.json +12 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby-after.js +16 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby.js +66 -0
- data/node_modules/axe-core/lib/checks/forms/group-labelledby.json +12 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys-after.js +19 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys.js +5 -0
- data/node_modules/axe-core/lib/checks/keyboard/accesskeys.json +12 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-disabled.js +25 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-disabled.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-no-name.js +6 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-no-name.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-not-tabbable.js +25 -0
- data/node_modules/axe-core/lib/checks/keyboard/focusable-not-tabbable.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/landmark-is-top-level.js +18 -0
- data/node_modules/axe-core/lib/checks/keyboard/landmark-is-top-level.json +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-elm-after.js +11 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-elm.js +9 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-heading-one.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-has-main.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-banner.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-contentinfo.json +15 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate-main.json +14 -0
- data/node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js +22 -0
- data/node_modules/axe-core/lib/checks/keyboard/tabindex.js +1 -0
- data/node_modules/axe-core/lib/checks/keyboard/tabindex.json +11 -0
- data/node_modules/axe-core/lib/checks/label/alt-space-value.js +2 -0
- data/node_modules/axe-core/lib/checks/label/alt-space-value.json +11 -0
- data/node_modules/axe-core/lib/checks/label/duplicate-img-label.js +19 -0
- data/node_modules/axe-core/lib/checks/label/duplicate-img-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/explicit.js +15 -0
- data/node_modules/axe-core/lib/checks/label/explicit.json +11 -0
- data/node_modules/axe-core/lib/checks/label/help-same-as-label.js +23 -0
- data/node_modules/axe-core/lib/checks/label/help-same-as-label.json +12 -0
- data/node_modules/axe-core/lib/checks/label/hidden-explicit-label.js +12 -0
- data/node_modules/axe-core/lib/checks/label/hidden-explicit-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/implicit.js +7 -0
- data/node_modules/axe-core/lib/checks/label/implicit.json +11 -0
- data/node_modules/axe-core/lib/checks/label/label-content-name-mismatch.js +49 -0
- data/node_modules/axe-core/lib/checks/label/label-content-name-mismatch.json +11 -0
- data/node_modules/axe-core/lib/checks/label/multiple-label.js +29 -0
- data/node_modules/axe-core/lib/checks/label/multiple-label.json +11 -0
- data/node_modules/axe-core/lib/checks/label/title-only.js +5 -0
- data/node_modules/axe-core/lib/checks/label/title-only.json +11 -0
- data/node_modules/axe-core/lib/checks/language/has-lang.js +5 -0
- data/node_modules/axe-core/lib/checks/language/has-lang.json +11 -0
- data/node_modules/axe-core/lib/checks/language/valid-lang.js +26 -0
- data/node_modules/axe-core/lib/checks/language/valid-lang.json +11 -0
- data/node_modules/axe-core/lib/checks/language/xml-lang-mismatch.js +5 -0
- data/node_modules/axe-core/lib/checks/language/xml-lang-mismatch.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/dlitem.js +23 -0
- data/node_modules/axe-core/lib/checks/lists/dlitem.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/listitem.js +18 -0
- data/node_modules/axe-core/lib/checks/lists/listitem.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/only-dlitems.js +42 -0
- data/node_modules/axe-core/lib/checks/lists/only-dlitems.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/only-listitems.js +68 -0
- data/node_modules/axe-core/lib/checks/lists/only-listitems.json +11 -0
- data/node_modules/axe-core/lib/checks/lists/structured-dlitems.js +22 -0
- data/node_modules/axe-core/lib/checks/lists/structured-dlitems.json +11 -0
- data/node_modules/axe-core/lib/checks/media/caption.js +8 -0
- data/node_modules/axe-core/lib/checks/media/caption.json +11 -0
- data/node_modules/axe-core/lib/checks/media/description.js +8 -0
- data/node_modules/axe-core/lib/checks/media/description.json +11 -0
- data/node_modules/axe-core/lib/checks/media/frame-tested.js +28 -0
- data/node_modules/axe-core/lib/checks/media/frame-tested.json +15 -0
- data/node_modules/axe-core/lib/checks/mobile/css-orientation-lock.js +132 -0
- data/node_modules/axe-core/lib/checks/mobile/css-orientation-lock.json +12 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport-large.json +15 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport-scale.js +38 -0
- data/node_modules/axe-core/lib/checks/mobile/meta-viewport.json +14 -0
- data/node_modules/axe-core/lib/checks/navigation/header-present.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/header-present.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order-after.js +14 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order.js +15 -0
- data/node_modules/axe-core/lib/checks/navigation/heading-order.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/internal-link-present.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/internal-link-present.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/landmark.js +3 -0
- data/node_modules/axe-core/lib/checks/navigation/landmark.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/meta-refresh.js +4 -0
- data/node_modules/axe-core/lib/checks/navigation/meta-refresh.json +11 -0
- data/node_modules/axe-core/lib/checks/navigation/p-as-heading.js +93 -0
- data/node_modules/axe-core/lib/checks/navigation/p-as-heading.json +30 -0
- data/node_modules/axe-core/lib/checks/navigation/region-after.js +1 -0
- data/node_modules/axe-core/lib/checks/navigation/region.js +85 -0
- data/node_modules/axe-core/lib/checks/navigation/region.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/skip-link.js +5 -0
- data/node_modules/axe-core/lib/checks/navigation/skip-link.json +12 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title-after.js +9 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title.js +6 -0
- data/node_modules/axe-core/lib/checks/navigation/unique-frame-title.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-active.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-after.js +8 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id-aria.json +12 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id.js +17 -0
- data/node_modules/axe-core/lib/checks/parsing/duplicate-id.json +12 -0
- data/node_modules/axe-core/lib/checks/shared/aria-label.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/aria-label.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/aria-labelledby.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/aria-labelledby.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/button-has-visible-text.js +12 -0
- data/node_modules/axe-core/lib/checks/shared/button-has-visible-text.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/doc-has-title.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/doc-has-title.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/exists.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/exists.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/has-alt.js +4 -0
- data/node_modules/axe-core/lib/checks/shared/has-alt.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/has-visible-text.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/has-visible-text.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/is-on-screen.js +4 -0
- data/node_modules/axe-core/lib/checks/shared/is-on-screen.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-alt.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-alt.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-if-present.js +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-if-present.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-title.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-title.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-value.js +2 -0
- data/node_modules/axe-core/lib/checks/shared/non-empty-value.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/role-none.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/role-none.json +11 -0
- data/node_modules/axe-core/lib/checks/shared/role-presentation.js +1 -0
- data/node_modules/axe-core/lib/checks/shared/role-presentation.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/caption-faked.js +10 -0
- data/node_modules/axe-core/lib/checks/tables/caption-faked.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-caption.js +1 -0
- data/node_modules/axe-core/lib/checks/tables/has-caption.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-summary.js +1 -0
- data/node_modules/axe-core/lib/checks/tables/has-summary.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/has-th.js +31 -0
- data/node_modules/axe-core/lib/checks/tables/has-th.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/headers-visible-text.js +30 -0
- data/node_modules/axe-core/lib/checks/tables/html5-scope.js +5 -0
- data/node_modules/axe-core/lib/checks/tables/html5-scope.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/same-caption-summary.js +7 -0
- data/node_modules/axe-core/lib/checks/tables/same-caption-summary.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/scope-value.js +5 -0
- data/node_modules/axe-core/lib/checks/tables/scope-value.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/td-has-header.js +29 -0
- data/node_modules/axe-core/lib/checks/tables/td-has-header.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/td-headers-attr.js +62 -0
- data/node_modules/axe-core/lib/checks/tables/td-headers-attr.json +11 -0
- data/node_modules/axe-core/lib/checks/tables/th-has-data-cells.js +76 -0
- data/node_modules/axe-core/lib/checks/tables/th-has-data-cells.json +12 -0
- data/node_modules/axe-core/lib/checks/tables/th-single-row-column.js +39 -0
- data/node_modules/axe-core/lib/checks/visibility/hidden-content.js +21 -0
- data/node_modules/axe-core/lib/checks/visibility/hidden-content.json +12 -0
- data/node_modules/axe-core/lib/commons/aria/arialabel-text.js +15 -0
- data/node_modules/axe-core/lib/commons/aria/arialabelledby-text.js +52 -0
- data/node_modules/axe-core/lib/commons/aria/attributes.js +45 -0
- data/node_modules/axe-core/lib/commons/aria/get-element-unallowed-roles.js +92 -0
- data/node_modules/axe-core/lib/commons/aria/get-owned-virtual.js +24 -0
- data/node_modules/axe-core/lib/commons/aria/get-role.js +44 -0
- data/node_modules/axe-core/lib/commons/aria/index.js +2417 -0
- data/node_modules/axe-core/lib/commons/aria/is-accessible-ref.js +55 -0
- data/node_modules/axe-core/lib/commons/aria/is-aria-role-allowed-on-element.js +41 -0
- data/node_modules/axe-core/lib/commons/aria/is-unsupported-role.js +14 -0
- data/node_modules/axe-core/lib/commons/aria/label-virtual.js +54 -0
- data/node_modules/axe-core/lib/commons/aria/named-from-contents.js +39 -0
- data/node_modules/axe-core/lib/commons/aria/roles.js +208 -0
- data/node_modules/axe-core/lib/commons/aria/validate-attr-value.js +63 -0
- data/node_modules/axe-core/lib/commons/color/contrast.js +172 -0
- data/node_modules/axe-core/lib/commons/color/element-is-distinct.js +88 -0
- data/node_modules/axe-core/lib/commons/color/get-background-color.js +411 -0
- data/node_modules/axe-core/lib/commons/color/get-foreground-color.js +32 -0
- data/node_modules/axe-core/lib/commons/color/incomplete-data.js +50 -0
- data/node_modules/axe-core/lib/commons/color/index.js +8 -0
- data/node_modules/axe-core/lib/commons/dom/elements-below-floating.js +39 -0
- data/node_modules/axe-core/lib/commons/dom/find-elms-in-context.js +28 -0
- data/node_modules/axe-core/lib/commons/dom/find-up.js +63 -0
- data/node_modules/axe-core/lib/commons/dom/get-composed-parent.js +25 -0
- data/node_modules/axe-core/lib/commons/dom/get-element-by-reference.js +34 -0
- data/node_modules/axe-core/lib/commons/dom/get-element-coordinates.js +38 -0
- data/node_modules/axe-core/lib/commons/dom/get-root-node.js +12 -0
- data/node_modules/axe-core/lib/commons/dom/get-scroll-offset.js +34 -0
- data/node_modules/axe-core/lib/commons/dom/get-tabbable-elements.js +24 -0
- data/node_modules/axe-core/lib/commons/dom/get-viewport-size.js +37 -0
- data/node_modules/axe-core/lib/commons/dom/has-content-virtual.js +73 -0
- data/node_modules/axe-core/lib/commons/dom/idrefs.js +36 -0
- data/node_modules/axe-core/lib/commons/dom/index.js +9 -0
- data/node_modules/axe-core/lib/commons/dom/is-focusable.js +90 -0
- data/node_modules/axe-core/lib/commons/dom/is-hidden-with-css.js +60 -0
- data/node_modules/axe-core/lib/commons/dom/is-html5.js +17 -0
- data/node_modules/axe-core/lib/commons/dom/is-in-text-block.js +95 -0
- data/node_modules/axe-core/lib/commons/dom/is-node.js +13 -0
- data/node_modules/axe-core/lib/commons/dom/is-offscreen.js +62 -0
- data/node_modules/axe-core/lib/commons/dom/is-visible.js +77 -0
- data/node_modules/axe-core/lib/commons/dom/is-visual-content.js +50 -0
- data/node_modules/axe-core/lib/commons/dom/shadow-elements-from-point.js +41 -0
- data/node_modules/axe-core/lib/commons/dom/visually-contains.js +62 -0
- data/node_modules/axe-core/lib/commons/dom/visually-overlaps.js +47 -0
- data/node_modules/axe-core/lib/commons/index.js +11 -0
- data/node_modules/axe-core/lib/commons/intro.stub +1 -0
- data/node_modules/axe-core/lib/commons/matches/attributes.js +23 -0
- data/node_modules/axe-core/lib/commons/matches/condition.js +19 -0
- data/node_modules/axe-core/lib/commons/matches/from-definition.js +47 -0
- data/node_modules/axe-core/lib/commons/matches/from-function.js +38 -0
- data/node_modules/axe-core/lib/commons/matches/from-primative.js +30 -0
- data/node_modules/axe-core/lib/commons/matches/index.js +37 -0
- data/node_modules/axe-core/lib/commons/matches/node-name.js +34 -0
- data/node_modules/axe-core/lib/commons/matches/properties.js +25 -0
- data/node_modules/axe-core/lib/commons/outro.stub +2 -0
- data/node_modules/axe-core/lib/commons/table/get-all-cells.js +28 -0
- data/node_modules/axe-core/lib/commons/table/get-cell-position.js +28 -0
- data/node_modules/axe-core/lib/commons/table/get-headers.js +29 -0
- data/node_modules/axe-core/lib/commons/table/get-scope.js +54 -0
- data/node_modules/axe-core/lib/commons/table/index.js +9 -0
- data/node_modules/axe-core/lib/commons/table/is-column-header.js +13 -0
- data/node_modules/axe-core/lib/commons/table/is-data-cell.js +22 -0
- data/node_modules/axe-core/lib/commons/table/is-data-table.js +190 -0
- data/node_modules/axe-core/lib/commons/table/is-header.js +22 -0
- data/node_modules/axe-core/lib/commons/table/is-row-header.js +13 -0
- data/node_modules/axe-core/lib/commons/table/to-grid.js +38 -0
- data/node_modules/axe-core/lib/commons/table/traverse.js +78 -0
- data/node_modules/axe-core/lib/commons/text/accessible-text-virtual.js +152 -0
- data/node_modules/axe-core/lib/commons/text/form-control-value.js +204 -0
- data/node_modules/axe-core/lib/commons/text/index.js +8 -0
- data/node_modules/axe-core/lib/commons/text/is-human-interpretable.js +51 -0
- data/node_modules/axe-core/lib/commons/text/is-valid-autocomplete.js +118 -0
- data/node_modules/axe-core/lib/commons/text/label-text.js +58 -0
- data/node_modules/axe-core/lib/commons/text/label-virtual.js +53 -0
- data/node_modules/axe-core/lib/commons/text/native-element-types.js +100 -0
- data/node_modules/axe-core/lib/commons/text/native-text-alternative.js +50 -0
- data/node_modules/axe-core/lib/commons/text/native-text-methods.js +122 -0
- data/node_modules/axe-core/lib/commons/text/sanitize.js +18 -0
- data/node_modules/axe-core/lib/commons/text/subtree-text.js +89 -0
- data/node_modules/axe-core/lib/commons/text/title-text.js +33 -0
- data/node_modules/axe-core/lib/commons/text/unicode.js +117 -0
- data/node_modules/axe-core/lib/commons/text/unsupported.js +5 -0
- data/node_modules/axe-core/lib/commons/text/visible-virtual.js +46 -0
- data/node_modules/axe-core/lib/commons/utils/index.js +10 -0
- data/node_modules/axe-core/lib/core/base/audit.js +684 -0
- data/node_modules/axe-core/lib/core/base/check-result.js +33 -0
- data/node_modules/axe-core/lib/core/base/check.js +123 -0
- data/node_modules/axe-core/lib/core/base/context.js +273 -0
- data/node_modules/axe-core/lib/core/base/rule-result.js +39 -0
- data/node_modules/axe-core/lib/core/base/rule.js +383 -0
- data/node_modules/axe-core/lib/core/constants.js +68 -0
- data/node_modules/axe-core/lib/core/imports/index.js +26 -0
- data/node_modules/axe-core/lib/core/index.js +45 -0
- data/node_modules/axe-core/lib/core/log.js +12 -0
- data/node_modules/axe-core/lib/core/public/cleanup-plugins.js +53 -0
- data/node_modules/axe-core/lib/core/public/configure.js +57 -0
- data/node_modules/axe-core/lib/core/public/get-rules.js +29 -0
- data/node_modules/axe-core/lib/core/public/load.js +66 -0
- data/node_modules/axe-core/lib/core/public/plugins.js +47 -0
- data/node_modules/axe-core/lib/core/public/reporter.js +24 -0
- data/node_modules/axe-core/lib/core/public/reset.js +12 -0
- data/node_modules/axe-core/lib/core/public/run-rules.js +94 -0
- data/node_modules/axe-core/lib/core/public/run.js +148 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/failure-summary.js +35 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/get-environment-data.js +39 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/incomplete-fallback-msg.js +11 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/index.js +3 -0
- data/node_modules/axe-core/lib/core/reporters/helpers/process-aggregate.js +102 -0
- data/node_modules/axe-core/lib/core/reporters/na.js +20 -0
- data/node_modules/axe-core/lib/core/reporters/no-passes.js +18 -0
- data/node_modules/axe-core/lib/core/reporters/raw.js +8 -0
- data/node_modules/axe-core/lib/core/reporters/v1.js +26 -0
- data/node_modules/axe-core/lib/core/reporters/v2.js +22 -0
- data/node_modules/axe-core/lib/core/utils/aggregate.js +19 -0
- data/node_modules/axe-core/lib/core/utils/aggregateChecks.js +85 -0
- data/node_modules/axe-core/lib/core/utils/aggregateNodeResults.js +61 -0
- data/node_modules/axe-core/lib/core/utils/aggregateResult.js +37 -0
- data/node_modules/axe-core/lib/core/utils/are-styles-set.js +24 -0
- data/node_modules/axe-core/lib/core/utils/check-helper.js +38 -0
- data/node_modules/axe-core/lib/core/utils/clone.js +27 -0
- data/node_modules/axe-core/lib/core/utils/collect-results-from-frames.js +127 -0
- data/node_modules/axe-core/lib/core/utils/contains.js +30 -0
- data/node_modules/axe-core/lib/core/utils/css-parser.js +5 -0
- data/node_modules/axe-core/lib/core/utils/dq-element.js +97 -0
- data/node_modules/axe-core/lib/core/utils/element-matches.js +39 -0
- data/node_modules/axe-core/lib/core/utils/escape-selector.js +79 -0
- data/node_modules/axe-core/lib/core/utils/extend-meta-data.js +17 -0
- data/node_modules/axe-core/lib/core/utils/finalize-result.js +11 -0
- data/node_modules/axe-core/lib/core/utils/find-by.js +14 -0
- data/node_modules/axe-core/lib/core/utils/flattened-tree.js +170 -0
- data/node_modules/axe-core/lib/core/utils/get-all-checks.js +12 -0
- data/node_modules/axe-core/lib/core/utils/get-base-lang.js +16 -0
- data/node_modules/axe-core/lib/core/utils/get-check-option.js +40 -0
- data/node_modules/axe-core/lib/core/utils/get-friendly-uri-end.js +144 -0
- data/node_modules/axe-core/lib/core/utils/get-root-node.js +17 -0
- data/node_modules/axe-core/lib/core/utils/get-selector.js +406 -0
- data/node_modules/axe-core/lib/core/utils/get-xpath.js +84 -0
- data/node_modules/axe-core/lib/core/utils/index.js +10 -0
- data/node_modules/axe-core/lib/core/utils/inject-style.js +38 -0
- data/node_modules/axe-core/lib/core/utils/is-hidden.js +40 -0
- data/node_modules/axe-core/lib/core/utils/is-html-element.js +135 -0
- data/node_modules/axe-core/lib/core/utils/is-shadow-root.js +40 -0
- data/node_modules/axe-core/lib/core/utils/is-xhtml.js +14 -0
- data/node_modules/axe-core/lib/core/utils/merge-results.js +116 -0
- data/node_modules/axe-core/lib/core/utils/node-sorter.js +21 -0
- data/node_modules/axe-core/lib/core/utils/performance-timer.js +121 -0
- data/node_modules/axe-core/lib/core/utils/pollyfills.js +299 -0
- data/node_modules/axe-core/lib/core/utils/preload-cssom.js +456 -0
- data/node_modules/axe-core/lib/core/utils/preload.js +109 -0
- data/node_modules/axe-core/lib/core/utils/publish-metadata.js +93 -0
- data/node_modules/axe-core/lib/core/utils/qsa.js +322 -0
- data/node_modules/axe-core/lib/core/utils/queue.js +138 -0
- data/node_modules/axe-core/lib/core/utils/respondable.js +243 -0
- data/node_modules/axe-core/lib/core/utils/rule-should-run.js +83 -0
- data/node_modules/axe-core/lib/core/utils/scroll-state.js +70 -0
- data/node_modules/axe-core/lib/core/utils/select.js +146 -0
- data/node_modules/axe-core/lib/core/utils/to-array.js +21 -0
- data/node_modules/axe-core/lib/core/utils/token-list.js +15 -0
- data/node_modules/axe-core/lib/core/utils/uuid.js +242 -0
- data/node_modules/axe-core/lib/core/utils/valid-input-type.js +35 -0
- data/node_modules/axe-core/lib/core/utils/valid-langs.js +8152 -0
- data/node_modules/axe-core/lib/intro.stub +15 -0
- data/node_modules/axe-core/lib/misc/any-failure-summary.json +6 -0
- data/node_modules/axe-core/lib/misc/incomplete-fallback.json +3 -0
- data/node_modules/axe-core/lib/misc/none-failure-summary.json +6 -0
- data/node_modules/axe-core/lib/outro.stub +2 -0
- data/node_modules/axe-core/lib/rules/accesskeys.json +13 -0
- data/node_modules/axe-core/lib/rules/area-alt.json +19 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-attr-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-role-matches.js +7 -0
- data/node_modules/axe-core/lib/rules/aria-allowed-role.json +14 -0
- data/node_modules/axe-core/lib/rules/aria-dpub-role-fallback-matches.js +10 -0
- data/node_modules/axe-core/lib/rules/aria-dpub-role-fallback.json +13 -0
- data/node_modules/axe-core/lib/rules/aria-has-attr-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-body.json +13 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-focus-matches.js +18 -0
- data/node_modules/axe-core/lib/rules/aria-hidden-focus.json +14 -0
- data/node_modules/axe-core/lib/rules/aria-required-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-required-children.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-required-parent.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-roles.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-valid-attr-value.json +12 -0
- data/node_modules/axe-core/lib/rules/aria-valid-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/audio-caption.json +20 -0
- data/node_modules/axe-core/lib/rules/autocomplete-matches.js +45 -0
- data/node_modules/axe-core/lib/rules/autocomplete-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/blink.json +19 -0
- data/node_modules/axe-core/lib/rules/button-name.json +27 -0
- data/node_modules/axe-core/lib/rules/bypass-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/bypass.json +20 -0
- data/node_modules/axe-core/lib/rules/checkboxgroup.json +12 -0
- data/node_modules/axe-core/lib/rules/color-contrast-matches.js +120 -0
- data/node_modules/axe-core/lib/rules/color-contrast.json +16 -0
- data/node_modules/axe-core/lib/rules/css-orientation-lock.json +13 -0
- data/node_modules/axe-core/lib/rules/data-table-large-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/data-table-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/definition-list.json +13 -0
- data/node_modules/axe-core/lib/rules/dlitem.json +13 -0
- data/node_modules/axe-core/lib/rules/document-title.json +13 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-active-matches.js +8 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-active.json +14 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-aria-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-aria.json +14 -0
- data/node_modules/axe-core/lib/rules/duplicate-id-misc-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/duplicate-id.json +14 -0
- data/node_modules/axe-core/lib/rules/empty-heading.json +13 -0
- data/node_modules/axe-core/lib/rules/focus-order-semantics.json +13 -0
- data/node_modules/axe-core/lib/rules/form-field-multiple-labels.json +13 -0
- data/node_modules/axe-core/lib/rules/frame-tested.json +12 -0
- data/node_modules/axe-core/lib/rules/frame-title-has-text.js +2 -0
- data/node_modules/axe-core/lib/rules/frame-title-unique.json +13 -0
- data/node_modules/axe-core/lib/rules/frame-title.json +25 -0
- data/node_modules/axe-core/lib/rules/heading-matches.js +15 -0
- data/node_modules/axe-core/lib/rules/heading-order.json +13 -0
- data/node_modules/axe-core/lib/rules/hidden-content.json +13 -0
- data/node_modules/axe-core/lib/rules/html-has-lang.json +12 -0
- data/node_modules/axe-core/lib/rules/html-lang-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/html-xml-lang-mismatch.json +13 -0
- data/node_modules/axe-core/lib/rules/image-alt.json +25 -0
- data/node_modules/axe-core/lib/rules/img-redundant-alt.json +12 -0
- data/node_modules/axe-core/lib/rules/input-image-alt.json +18 -0
- data/node_modules/axe-core/lib/rules/inserted-into-focus-order-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/label-content-name-mismatch-matches.js +42 -0
- data/node_modules/axe-core/lib/rules/label-content-name-mismatch.json +12 -0
- data/node_modules/axe-core/lib/rules/label-matches.js +11 -0
- data/node_modules/axe-core/lib/rules/label-title-only.json +13 -0
- data/node_modules/axe-core/lib/rules/label.json +26 -0
- data/node_modules/axe-core/lib/rules/landmark-banner-is-top-level.json +13 -0
- data/node_modules/axe-core/lib/rules/landmark-complementary-is-top-level.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-contentinfo-is-top-level.json +13 -0
- data/node_modules/axe-core/lib/rules/landmark-has-body-context.js +8 -0
- data/node_modules/axe-core/lib/rules/landmark-main-is-top-level.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-no-duplicate-banner.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-no-duplicate-contentinfo.json +12 -0
- data/node_modules/axe-core/lib/rules/landmark-one-main.json +12 -0
- data/node_modules/axe-core/lib/rules/layout-table-matches.js +8 -0
- data/node_modules/axe-core/lib/rules/layout-table.json +13 -0
- data/node_modules/axe-core/lib/rules/link-in-text-block-matches.js +14 -0
- data/node_modules/axe-core/lib/rules/link-in-text-block.json +14 -0
- data/node_modules/axe-core/lib/rules/link-name.json +26 -0
- data/node_modules/axe-core/lib/rules/list.json +13 -0
- data/node_modules/axe-core/lib/rules/listitem.json +13 -0
- data/node_modules/axe-core/lib/rules/marquee.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-refresh.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-viewport-large.json +13 -0
- data/node_modules/axe-core/lib/rules/meta-viewport.json +13 -0
- data/node_modules/axe-core/lib/rules/no-role-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/not-html-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/object-alt.json +25 -0
- data/node_modules/axe-core/lib/rules/p-as-heading-matches.js +17 -0
- data/node_modules/axe-core/lib/rules/p-as-heading.json +13 -0
- data/node_modules/axe-core/lib/rules/page-has-heading-one.json +12 -0
- data/node_modules/axe-core/lib/rules/radiogroup.json +12 -0
- data/node_modules/axe-core/lib/rules/region.json +13 -0
- data/node_modules/axe-core/lib/rules/role-not-button-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/scope-attr-valid.json +12 -0
- data/node_modules/axe-core/lib/rules/server-side-image-map.json +18 -0
- data/node_modules/axe-core/lib/rules/skip-link-matches.js +1 -0
- data/node_modules/axe-core/lib/rules/skip-link.json +13 -0
- data/node_modules/axe-core/lib/rules/tabindex.json +12 -0
- data/node_modules/axe-core/lib/rules/table-duplicate-name.json +12 -0
- data/node_modules/axe-core/lib/rules/table-fake-caption.json +20 -0
- data/node_modules/axe-core/lib/rules/td-has-header.json +20 -0
- data/node_modules/axe-core/lib/rules/td-headers-attr.json +12 -0
- data/node_modules/axe-core/lib/rules/th-has-data-cells.json +13 -0
- data/node_modules/axe-core/lib/rules/valid-lang.json +13 -0
- data/node_modules/axe-core/lib/rules/video-caption.json +19 -0
- data/node_modules/axe-core/lib/rules/video-description.json +19 -0
- data/node_modules/axe-core/lib/rules/window-is-top.js +3 -0
- data/node_modules/axe-core/lib/rules/xml-lang-mismatch-matches.js +12 -0
- data/node_modules/axe-core/locales/de.json +627 -0
- data/node_modules/axe-core/locales/fr.json +667 -0
- data/node_modules/axe-core/locales/ja.json +728 -0
- data/node_modules/axe-core/locales/nl.json +36 -0
- data/node_modules/axe-core/package.json +215 -0
- data/node_modules/axe-core/sri-history.json +138 -0
- data/node_modules/axe-core/typings/axe-core/axe-core-tests.ts +180 -0
- data/node_modules/govuk-frontend/all.js +19 -14
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +1 -3
- data/node_modules/govuk-frontend/components/summary-list/macro-options.json +12 -6
- data/node_modules/govuk-frontend/components/summary-list/template.njk +1 -1
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +1 -1
- data/node_modules/govuk-frontend/helpers/_typography.scss +3 -2
- data/node_modules/govuk-frontend/objects/_main-wrapper.scss +10 -2
- data/node_modules/govuk-frontend/package.json +10 -10
- data/node_modules/govuk-frontend/settings/_typography-font.scss +12 -0
- metadata +513 -3
- data/app/assets/javascripts/component_guide/vendor/axe.min.js +0 -41
@@ -0,0 +1,33 @@
|
|
1
|
+
# How we make decisions on rules
|
2
|
+
|
3
|
+
In order to adhere to the manifesto and at the same time be useful to developers and content creators, we evaluate all rules according to strict normative WCAG 2 interpretation. We also pay very strong attention to the normative portion of WCAG 2 known as [accessibility supported](https://www.w3.org/TR/WCAG20/#accessibility-supporteddef).
|
4
|
+
|
5
|
+
## Accessibility supported
|
6
|
+
|
7
|
+
Boiled-down, accessibility supported means that in order for a technique to be valid, it must work on all viable platforms for all assitive technology that are widely used and freely available (paraphrased).
|
8
|
+
|
9
|
+
We currently test the following AT combinations for support
|
10
|
+
|
11
|
+
1. VoiceOver and Safari on OS X
|
12
|
+
1. VoiceOver and Safari on iOS
|
13
|
+
1. JAWS and IE on Windows
|
14
|
+
1. NVDA and Firefox on Windows
|
15
|
+
1. Talkback and Chrome on Android
|
16
|
+
1. Dragon and Firefox on Windows
|
17
|
+
|
18
|
+
## Impact on ARIA
|
19
|
+
|
20
|
+
For some technologies, like ARIA, we have a dilemma in that the spec is approved before supported and we have to weigh a balance between something that conforms to the spec, but does not yet work. When we do this, we favor the accessibility supported principle over the spec but we temper this with the impact of using an unsupported feature. Here is how we do this:
|
21
|
+
|
22
|
+
1. If the feature's use is supported by all platforms: allow, else
|
23
|
+
1. If the feature's use does not have a negative impact on accessibility: allow, else
|
24
|
+
1. If we can detect a fallback: allow, else
|
25
|
+
1. disallow the feature's use until it is supported
|
26
|
+
|
27
|
+
In addition, we disallow invalid attributes starting with `aria-` and invalid attribute values as these are highly likely to have a negative impact on accessibility because of the scenarios under which these are likely to occur (this is so we can act as a useful linting tool for developers).
|
28
|
+
|
29
|
+
## Best practices
|
30
|
+
|
31
|
+
We recognize that there are best practices that significantly improve the usability of application, even though they are not strictly required in order to conform with WCAG 2. We develop the best practice rules to help content developers to identify these and adhere to them.
|
32
|
+
|
33
|
+
We recognize that this topic is somewhat controvertial and the rules we have represent Deque's opinion on what constitutes a best practice.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# W3C Standardized Rules
|
2
|
+
|
3
|
+
Deque Systems is one of leading organizations in the development of standardized accessibility conformance testing rules. The [axe-core rules proposal format](./rule-proposal.md) is an adaptation of the [Accessibility Conformance Testing Rules Format](https://www.w3.org/TR/act-rules-format/).
|
4
|
+
|
5
|
+
There are two ways a rule written in the axe-core rule format can be transformed into the ACT Rules format:
|
6
|
+
|
7
|
+
## Method 1: Create a single rule
|
8
|
+
|
9
|
+
This method is useful for rules with a small number of checks.
|
10
|
+
|
11
|
+
1. Add the test input type to it: `rendered page`
|
12
|
+
2. Add an `assumptions` section, add possible assumptions to it
|
13
|
+
3. Add an `outcomes` section, describing the different possible outcomes of the rule
|
14
|
+
4. Add a `Validation Tests` section, that links to the integration tests
|
15
|
+
5. Update the check to return pass/fail/cantTell instead of true/false/undefined
|
16
|
+
6. Add control flow to the checks:
|
17
|
+
|
18
|
+
- `any` checks should only return `fail` in the last step. All steps leading up to it either return `pass` or say `continue to the next step`.
|
19
|
+
- `all` and `none` checks should only return `pass` in the last step. All steps leading up to it either return `fail` or say `continue to the next step`.
|
20
|
+
|
21
|
+
7. Rename `checks` to `steps` and add a `step X` (where X is the step number) to the heading with the check name.
|
22
|
+
8. Replace the `tags` section with a `Accessibility Requirements`. The requirements can be determined based on the `wcag###` tags.
|
23
|
+
|
24
|
+
## Method 2: Create a rule group
|
25
|
+
|
26
|
+
This method is useful for larger rules with `any` checks. This effectively turns every check into its own rule, and turns the rule into a rule group.
|
27
|
+
|
28
|
+
1. Copy each check into a new document
|
29
|
+
2. Add a `steps` heading
|
30
|
+
3. Add the test input type to it: `rendered page`
|
31
|
+
4. Add an `assumptions` section, add possible assumptions to it
|
32
|
+
5. Add an `outcomes` section, describing the different possible outcomes of the rule
|
33
|
+
6. Copy the `selector` section from the original rule into the new rule documents
|
34
|
+
7. Update the check to return pass/fail/cantTell instead of true/false/undefined
|
35
|
+
8. Add a `Validation Tests` section, that links to only those integration tests relevant for this check (now a new rule).
|
36
|
+
9. Indicate that the new rule is part of a group, using the original axe-core rule ID as the group name.
|
37
|
+
10. Replace the `tags` section with a `Accessibility Requirements`. The requirements can be determined based on the `wcag###` tags.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# ARIA Roles and Attributes unsupported in axe-core.
|
2
|
+
|
3
|
+
It can be difficult to know which features of web technologies are accessible across different platforms, and with different screen readers and other assistive technologies. Axe-core does some of this work for you, by raising issues when accessibility features are used that are known to cause problems.
|
4
|
+
|
5
|
+
This page contains a list of ARIA 1.1 features that axe-core raises as unsupported. For more information, read [We’ve got your back with “Accessibility Supported” in axe](https://www.deque.com/blog/weve-got-your-back-with-accessibility-supported-in-axe/).
|
6
|
+
|
7
|
+
For a detailed description about how accessibility support is decided, see [How we make decisions on rules](accessibility-supported.md).
|
8
|
+
|
9
|
+
## Roles
|
10
|
+
|
11
|
+
| aria-role | axe-core support |
|
12
|
+
| --------- | ---------------- |
|
13
|
+
| figure | No |
|
14
|
+
|
15
|
+
## Attributes
|
16
|
+
|
17
|
+
| aria-attribute | axe-core support |
|
18
|
+
| -------------------- | ---------------- |
|
19
|
+
| aria-describedat | No |
|
20
|
+
| aria-details | No |
|
21
|
+
| aria-roledescription | Mixed[^1] |
|
22
|
+
|
23
|
+
[^1]: Supported on elements: `<button>`, `<input type="button" | "checkbox" | "image" | "radio" | "reset" | "submit">`, `<img>`, `<select>`, `<summary>`
|
Binary file
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# Code Submission Guidelines
|
2
|
+
|
3
|
+
We've enacted standards for commits and pull requests to effectively manage the project over
|
4
|
+
time. We expect all code contributed to follow these standards. If your code doesn't follow them, we
|
5
|
+
will kindly ask you to resubmit it in the correct format.
|
6
|
+
|
7
|
+
- [Git Commits](#git-commits)
|
8
|
+
- [Submitting a pull request](#submitting-a-pull-request)
|
9
|
+
- [Merging a pull request](#merging-a-pull-request)
|
10
|
+
- [Squashing Commits](#squashing-everything-into-one-commit)
|
11
|
+
|
12
|
+
## Git Commits
|
13
|
+
|
14
|
+
We follow Angular's code contribution style with precise rules for formatting git commit messages.
|
15
|
+
This leads to more readable messages that are easy to follow when looking through the project
|
16
|
+
history. We will also use commit messages to generate the aXe Changelog document.
|
17
|
+
|
18
|
+
A detailed explanation of Angular's guidelines and conventions can be found [on Google Docs](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#).
|
19
|
+
|
20
|
+
### Commit Message Format
|
21
|
+
|
22
|
+
Each commit message should consist of a header, a body and a footer. The header has a special format
|
23
|
+
that includes a type, a scope and a subject. Here's a sample of the format:
|
24
|
+
|
25
|
+
```
|
26
|
+
<type>(<scope>): <subject>
|
27
|
+
<BLANK LINE>
|
28
|
+
<body>
|
29
|
+
<BLANK LINE>
|
30
|
+
<footer>
|
31
|
+
```
|
32
|
+
|
33
|
+
### Here's an example:
|
34
|
+
|
35
|
+
```sh
|
36
|
+
perf(rule): improve speed of color contrast rules
|
37
|
+
|
38
|
+
Use async process to compare elements without UI lockup
|
39
|
+
|
40
|
+
Closes #1
|
41
|
+
```
|
42
|
+
|
43
|
+
> Commit messages should be 100 characters or less to make them easy to read on Github and
|
44
|
+
> various git tools.
|
45
|
+
|
46
|
+
### How to structure your commits:
|
47
|
+
|
48
|
+
#### Type
|
49
|
+
|
50
|
+
Must be one of the following:
|
51
|
+
|
52
|
+
- **feat:** A new feature
|
53
|
+
- **fix:** A bug fix
|
54
|
+
- **docs:** Documentation only changes
|
55
|
+
- **style:** Changes that do not affect the meaning of the code (white-space, formatting, missing
|
56
|
+
semi-colons, etc)
|
57
|
+
- **refactor:** A code change that neither fixes a bug nor adds a feature
|
58
|
+
- **perf:** A code change that improves performance
|
59
|
+
- **test:** Adding missing tests
|
60
|
+
- **chore:** Changes to the build process or auxiliary tools and libraries such as documentation
|
61
|
+
generation
|
62
|
+
|
63
|
+
#### Scope
|
64
|
+
|
65
|
+
The scope specifies the place of the commit change in the codebase along with the type. It could
|
66
|
+
reference a rule, a commons file, or anything really. E.g. `feat(rule)` or
|
67
|
+
`test(commons/aria)`. It would help us call to out rule changes in our changelog with `rule` used as the scope.
|
68
|
+
|
69
|
+
If the scope is too broad to summarize, use the type only and leave off the parentheses. E.g.
|
70
|
+
`type: some subject`. Keep in mind that a long scope often pushes your commit message over 100 characters.
|
71
|
+
Brevity is helpful for everyone!
|
72
|
+
|
73
|
+
#### Subject
|
74
|
+
|
75
|
+
The subject contains succinct description of the change:
|
76
|
+
|
77
|
+
- use the imperative, present tense: "change" not "changed" nor "changes"
|
78
|
+
- don't capitalize first letter
|
79
|
+
- no dot (.) at the end
|
80
|
+
|
81
|
+
#### Body
|
82
|
+
|
83
|
+
Use the imperative, present tense: "change" not "changed" nor "changes", just like the subject.
|
84
|
+
Include the motivation for the change and contrast it with how the code worked before.
|
85
|
+
|
86
|
+
#### Footer
|
87
|
+
|
88
|
+
Reference any issue that this commit closes with its fully qualified URL to support both
|
89
|
+
Bitbucket and Github.
|
90
|
+
|
91
|
+
If needed, the footer should contain any information about Breaking Changes. Deprecation notices or
|
92
|
+
breaking changes in the Changelog should inform users if they'll need to modify their code after
|
93
|
+
this commit.
|
94
|
+
|
95
|
+
## Submitting a pull request
|
96
|
+
|
97
|
+
We want to keep our commit log clean by avoiding merge messages in branches. Before submitting a pull request, make sure your branch is up to date with the develop branch by either:
|
98
|
+
|
99
|
+
- Pulling from develop before creating your branch
|
100
|
+
- Doing a rebase from origin/develop (will require a force push **on your branch**)
|
101
|
+
|
102
|
+
To rebase from origin/develop if we've pushed changes since you created your branch:
|
103
|
+
|
104
|
+
```sh
|
105
|
+
git checkout your-branch
|
106
|
+
git fetch
|
107
|
+
git rebase origin/develop
|
108
|
+
git push origin head -f
|
109
|
+
```
|
110
|
+
|
111
|
+
## Merging a pull request
|
112
|
+
|
113
|
+
If a pull request has many commits (especially if they don't follow our [commit policy](#git-commits)), you'll want to squash them into one clean commit.
|
114
|
+
|
115
|
+
In the Github UI, you can use the new [Squash and Merge](https://github.com/blog/2141-squash-your-commits) feature to make this easy. If there are merge conflicts preventing this, either ask the committer to rebase from develop following the [PR submission steps above](#submitting-a-pull-request), or use the manual method below.
|
116
|
+
|
117
|
+
To apply a pull request manually, make sure your local develop branch is up to date. Then, create a new branch for that pull request.
|
118
|
+
|
119
|
+
Create a temporary, local branch:
|
120
|
+
|
121
|
+
```sh
|
122
|
+
git checkout -b temp-feature-branch
|
123
|
+
```
|
124
|
+
|
125
|
+
Run the following commands to apply all commits from that pull request on top of your branch's local history:
|
126
|
+
|
127
|
+
```console
|
128
|
+
curl -L https://github.com/dequelabs/axe-core/pull/205.patch | git am -3
|
129
|
+
```
|
130
|
+
|
131
|
+
If the merge succeeds, use `git diff origin/develop` to review all the changes that will happen
|
132
|
+
post-merge.
|
133
|
+
|
134
|
+
## Squashing everything into one commit
|
135
|
+
|
136
|
+
Before merging a pull request with many commits into develop, make sure there is only one commit representing the
|
137
|
+
changes in the pull request, so the git log stays lean. We particularly want to avoid merge messages and vague commits that don't follow our commit policy (like `Merged develop into featurebranch` or `fixed some stuff`).
|
138
|
+
|
139
|
+
You can use git's interactive rebase to manipulate, merge, and rename commits in your local
|
140
|
+
history. If these steps are followed, a force push shouldn't be necessary.
|
141
|
+
|
142
|
+
**Do not force push to develop or master under any circulstances.**
|
143
|
+
|
144
|
+
To interactively rebase all of your commits on top of the latest in develop, run:
|
145
|
+
|
146
|
+
```sh
|
147
|
+
git rebase --interactive origin/develop
|
148
|
+
```
|
149
|
+
|
150
|
+
This brings up an interactive dialog in your text editor. Follow the instructions to squash all
|
151
|
+
of your commits into the top one. Rename the top one.
|
152
|
+
|
153
|
+
Once this is done, run `git log` and you will see only one commit after develop, representing
|
154
|
+
everything from the pull request.
|
155
|
+
|
156
|
+
Finally, pull from develop with `rebase` to put all of our local commits on top of the latest
|
157
|
+
remote.
|
158
|
+
|
159
|
+
```sh
|
160
|
+
git pull --rebase origin develop
|
161
|
+
```
|
162
|
+
|
163
|
+
You can then push the latest code to develop (note that force push isn't needed if these steps are followed):
|
164
|
+
|
165
|
+
```console
|
166
|
+
git push origin develop
|
167
|
+
```
|
168
|
+
|
169
|
+
## Writing Integration Tests
|
170
|
+
|
171
|
+
For each rule, axe-core needs to have integration tests. These tests are located in `tests/integration`.
|
172
|
+
This directory contains two other directories. `rules`, which contains integration tests that can be run
|
173
|
+
on a single page, and `full` which contains tests that can only be tested by running on multiple pages.
|
174
|
+
|
175
|
+
Ensure that for each check used in the rule, there is an integration test for both pass and fail results.
|
176
|
+
Integration tests put in `rules` can be described using simple code snippets in an HTML file, and a JSON
|
177
|
+
file that describes the expected outcome. For `full` tests, a complete Jasmine test should be created,
|
178
|
+
including at least one HTML file that has the tested code, and a JS file that has the test statements.
|
@@ -0,0 +1,500 @@
|
|
1
|
+
# aXe Developer Guide
|
2
|
+
|
3
|
+
aXe runs a series of tests to check for accessibility of content and functionality on a website. A test is made up of a series of Rules which are, themselves, made up of Checks. aXe executes these Rules asynchronously and, when the Rules are finished running, runs a callback function which is passed a Result structure. Since some Rules run on the page level while others do not, tests will also run in one of two ways. If a document is specified, the page level rules will run, otherwise they will not.
|
4
|
+
|
5
|
+
aXe 3.0 supports open Shadow DOM: see our virtual DOM APIs and test utilities for developing axe-core moving forward. Note: we do not and cannot support closed Shadow DOM.
|
6
|
+
|
7
|
+
1. [Getting Started](#getting-started)
|
8
|
+
1. [Architecture Overview](#architecture-overview)
|
9
|
+
1. [Rules](#rules)
|
10
|
+
1. [Checks](#checks)
|
11
|
+
1. [Common Functions](#common-functions)
|
12
|
+
1. [Virtual Nodes](#virtual-nodes)
|
13
|
+
1. [Core Utilities](#core-utilities)
|
14
|
+
1. [Virtual DOM APIs](#virtual-dom-apis)
|
15
|
+
1. [API Name: axe.utils.getFlattenedTree](#api-name-axeutilsgetflattenedtree)
|
16
|
+
1. [API Name: axe.utils.getNodeFromTree](#api-name-axeutilsgetnodefromtree)
|
17
|
+
1. [Test Utilities](#test-utilities)
|
18
|
+
1. [Test Util Name: axe.testUtils.MockCheckContext](#test-util-name-axetestutilsmockcheckcontext)
|
19
|
+
1. [Test Util Name: axe.testUtils.shadowSupport](#test-util-name-axetestutilsshadowsupport)
|
20
|
+
1. [Test Util Name: axe.testUtils.fixtureSetup](#test-util-name-axetestutilsfixturesetup)
|
21
|
+
1. [Test Util Name: axe.testUtils.checkSetup](#test-util-name-axetestutilschecksetup)
|
22
|
+
1. [Using Rule Generation CLI](#axe-rule-generator)
|
23
|
+
|
24
|
+
## Getting Started
|
25
|
+
|
26
|
+
### Environment Pre-requisites
|
27
|
+
|
28
|
+
1. You must have NodeJS installed.
|
29
|
+
2. Grunt must be installed globally. `npm install -g grunt-cli` (You may need to do this as `sudo npm install -g grunt-cli`)
|
30
|
+
3. Install npm development dependencies. In the root folder of your axe-core repository, run `npm install`
|
31
|
+
|
32
|
+
### Building axe.js
|
33
|
+
|
34
|
+
To build axe.js, simply run `grunt build` in the root folder of the axe-core repository. axe.js and axe.min.js are placed into the `dist` folder.
|
35
|
+
|
36
|
+
### Running Tests
|
37
|
+
|
38
|
+
To run all tests from the command line you can run `grunt test`, which will run all unit and integration tests using PhantomJS and Selenium Webdriver.
|
39
|
+
|
40
|
+
You can also load tests in any supported browser, which is helpful for debugging. Tests require a local server to run, you must first start a local server to serve files. You can use Grunt to start one by running `grunt dev`. Once your local server is running you can load the following pages in any browser to run tests:
|
41
|
+
|
42
|
+
1. [Core Tests](../test/core/)
|
43
|
+
2. [Commons Tests](../test/commons/)
|
44
|
+
3. [Check Tests](../test/checks/)
|
45
|
+
4. [Integration Tests](../test/integration/rules/)
|
46
|
+
5. There are additional tests located in [test/integration/full/](../test/integration/full/) for tests that need to be run against their own document.
|
47
|
+
|
48
|
+
### API Reference
|
49
|
+
|
50
|
+
[See API exposed on aXe](./API.md#section-2-api-reference)
|
51
|
+
|
52
|
+
## Architecture Overview
|
53
|
+
|
54
|
+
aXe tests for accessibility using objects called Rules. Each Rule tests for a high-level aspect of accessibility, such as color contrast, button labels, and alternate text for images. Each rule is made up of a series of Checks. Depending on the rule; all, some, or none of these checks must pass in order for the rule to pass.
|
55
|
+
|
56
|
+
Upon execution, a Rule runs each of its Checks against all relevant nodes. Which nodes are relevant is determined by the Rule's `selector` property and `matches` function. If a Rule has no Checks that apply to a given node, the Rule will result in an inapplicable result.
|
57
|
+
|
58
|
+
After execution, a Check will return `true` or `false` depending on whether or not the tested condition was satisfied. The result, as well as more information on what caused the Check to pass or fail, will be stored in either the `passes` array or the `violations` array.
|
59
|
+
|
60
|
+
### Rules
|
61
|
+
|
62
|
+
Rules are defined by JSON files in the [lib/rules directory](../lib/rules). The JSON object is used to seed the [Rule object](../lib/core/base/rule.js#L30). A valid Rule JSON consists of the following:
|
63
|
+
|
64
|
+
- `id` - `String` A unique name of the Rule.
|
65
|
+
- `selector` - **optional** `String` which is a CSS selector that specifies the elements of the page on which the Rule runs. aXe-core will look inside of the light DOM and _open_ [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM) trees for elements matching the provided selector. If omitted, the rule will run against every node.
|
66
|
+
- `excludeHidden` - **optional** `Boolean` Whether the rule should exclude hidden elements. Defaults to `true`.
|
67
|
+
- `enabled` - **optional** `Boolean` Whether the rule is enabled by default. Defaults to `true`.
|
68
|
+
- `pageLevel` - **optional** `Boolean` Whether the rule is page level. Page level rules will only run if given an entire `document` as context.
|
69
|
+
- `matches` - **optional** `String` Relative path to the JavaScript file of a custom matching function. See [matches function](#matches-function) for more information.
|
70
|
+
- `tags` - **optional** `Array` Strings of the accessibility guidelines of which the Rule applies.
|
71
|
+
- `metadata` - `Object` Consisting of:
|
72
|
+
- `description` - `String` Text string that describes what the rule does.
|
73
|
+
- `helpUrl` - `String` **optional** URL that provides more information about the specifics of the violation. Links to a page on the Deque University site.
|
74
|
+
- `help` - `String` Help text that describes the test that was performed.
|
75
|
+
- `any` - `Array` Checks that make up this Rule; one of these checks must return `true` for a Rule to pass.
|
76
|
+
- `all` - `Array` Checks that make up this Rule; all these checks must return `true` for a Rule to pass.
|
77
|
+
- `none` - `Array` Checks that make up this Rule; none of these checks must return `true` for a Rule to pass.
|
78
|
+
|
79
|
+
The `any`, `all` and `none` arrays must contain either a `String` which references the `id` of the Check; or an object of the following format:
|
80
|
+
|
81
|
+
- `id` - `String` The unique ID of the Check.
|
82
|
+
- `options` - `Mixed` Any options the Check requires that are specific to the Rule.
|
83
|
+
|
84
|
+
There is a Grunt target which will ensure each Rule has a valid format, which can be run with `grunt validate`.
|
85
|
+
|
86
|
+
#### Matches Function
|
87
|
+
|
88
|
+
Custom `matches` functions are executed against each node which matches the Rule's `selector` and receive two parameters:
|
89
|
+
|
90
|
+
- `node` – node, the DOM Node to test
|
91
|
+
- `virtualNode`– object, the virtual DOM representation of the node. See [virtualNode documentation](#virtual-nodes) for more.
|
92
|
+
|
93
|
+
The matches function must return either `true` or `false`. Common functions are provided as `commons`. [See the data-table matches function for an example.](../lib/rules/data-table-matches.js)
|
94
|
+
|
95
|
+
### Checks
|
96
|
+
|
97
|
+
Similar to Rules, Checks are defined by JSON files in the [lib/checks directory](../lib/checks). The JSON object is used to seed the [Check object](../lib/core/base/check.js). A valid Check JSON consists of the following:
|
98
|
+
|
99
|
+
- `id` - `String` A unique name of the Check
|
100
|
+
- `evaluate` - `String` Relative path to the JavaScript file which contains the function body of the Check itself
|
101
|
+
- `after` - **optional** `String` Relative path to the JavaScript file which contains the function body of a Check's after (or post-processing) function.f
|
102
|
+
- `options` - **optional** `Mixed` Any information the Check needs that you might need to customize and/or is locale specific. Options can be overridden at runtime (with the options parameter) or config-time. For example, the [valid-lang](../lib/checks/language/valid-lang.json) Check defines what ISO 639-1 language codes it should accept as valid. Options do not need to follow any specific format or type; it is up to the author of a Check to determine the most appropriate format.
|
103
|
+
- `metadata` - `Object` Consisting of:
|
104
|
+
- `impact` - `String` (one of `minor`, `moderate`, `serious`, or `critical`)
|
105
|
+
- `messages` - `Object` These messages are displayed when the Check passes or fails
|
106
|
+
- `pass` - `String` [doT.js](http://olado.github.io/doT/) template string displayed when the Check passes
|
107
|
+
- `fail` - `String` [doT.js](http://olado.github.io/doT/) template string displayed when the Check fails
|
108
|
+
- `incomplete` – `String|Object` – [doT.js](http://olado.github.io/doT/) template string displayed when the Check is incomplete OR an object with `missingData` on why it returned incomplete. Refer to [rules.md](./rules.md).
|
109
|
+
|
110
|
+
#### Check `evaluate`
|
111
|
+
|
112
|
+
A Check's evaluate function is run a special context in order to give access to APIs which provide more information. Checks will run against a single node and do not have access to other frames. A Check must either return `true` or `false`.
|
113
|
+
|
114
|
+
The following variables are defined for `Check#evaluate`:
|
115
|
+
|
116
|
+
- `node` - `HTMLElement` The element that the Check is run against
|
117
|
+
- `options` - `Mixed` Any options specific to this Check that may be necessary. If not specified by the user at run-time or configure-time; it will use `options` as defined by the Check's JSON file.
|
118
|
+
- `virtualNode` – `Object` The virtualNode object for use with Shadow DOM. See [virtualNode documentation](#virtual-nodes).
|
119
|
+
- `this.data()` - `Function` Free-form data that either the Check message requires or is presented as `data` in the CheckResult object. Subsequent calls to `this.data()` will overwrite previous. See [aria-valid-attr](../lib/checks/aria/valid-attr.js) for example usage.
|
120
|
+
- `this.relatedNodes()` - `Function` Array or NodeList of elements that are related to this Check. For example the [duplicate-id](../lib/checks/shared/duplicate-id.js) Check will add all Elements which share the same ID.
|
121
|
+
- `commons` - Common functions that may be used across multiple Checks. See [Common Functions](#common-functions) for more information.
|
122
|
+
|
123
|
+
#### Check `after`
|
124
|
+
|
125
|
+
You can use the `after` function to evaluate nodes that might be in other frames or to filter the number of violations or passes produced. The `after` function runs once for each Rule in the top-most (or originating) frame. Due to this, you should not perform DOM operations in after functions, but instead operate on `data` defined by the Check.
|
126
|
+
|
127
|
+
For example, the [duplicate-id](../lib/checks/shared/duplicate-id.json) Check include an [after function](../lib/checks/shared/duplicate-id-after.js) which reduces the number of violations so that only one violation per instance of a duplicate ID is found.
|
128
|
+
|
129
|
+
The following variables are defined for `Check#after`:
|
130
|
+
|
131
|
+
- `results` - `Array` Contains [CheckResults](#checkresult) for every matching node.
|
132
|
+
- `commons` - Common functions that may be used across multiple Checks. See [Common Functions](#common-functions) for more information.
|
133
|
+
|
134
|
+
The after function must return an `Array` of CheckResults, due to this, it is a very common pattern to just use `Array#filter` to filter results:
|
135
|
+
|
136
|
+
```js
|
137
|
+
var uniqueIds = [];
|
138
|
+
return results.filter(function(r) {
|
139
|
+
if (uniqueIds.indexOf(r.data) === -1) {
|
140
|
+
uniqueIds.push(r.data);
|
141
|
+
return true;
|
142
|
+
}
|
143
|
+
return false;
|
144
|
+
});
|
145
|
+
```
|
146
|
+
|
147
|
+
#### Pass, Fail and Incomplete Templates
|
148
|
+
|
149
|
+
Occasionally, you may want to add additional information about why a Check passed, failed or returned undefined into its message. For example, the [aria-valid-attr](../lib/checks/aria/valid-attr.json) will add information about any invalid ARIA attributes to its fail message. The message uses the [doT.js](http://olado.github.io/doT/) and is compiled to a JavaScript function at build-time. In the Check message, you have access to the `CheckResult` as `it`.
|
150
|
+
|
151
|
+
```js
|
152
|
+
// aria-valid-attr check
|
153
|
+
"messages": {
|
154
|
+
"pass": "ARIA attributes are used correctly for the defined role",
|
155
|
+
"fail": "ARIA attribute{{=it.data && it.data.length > 1 ? 's are' : ' is'}} not allowed:{{~it.data:value}} {{=value}}{{~}}",
|
156
|
+
"incomplete": "axe-core couldn't tell because of {{it.data.missingData}}"
|
157
|
+
}
|
158
|
+
```
|
159
|
+
|
160
|
+
See [Developing Axe-core Rules](./rule-development.md) for more information
|
161
|
+
on writing rules and checks, including incomplete results.
|
162
|
+
|
163
|
+
#### CheckResult
|
164
|
+
|
165
|
+
When a Check is executed, its result is then added to a [CheckResult object](../lib/core/base/check-result.js). Much like the RuleResult object, the CheckResult object only contains information that is required to determine whether a Check, and its parent Rule passed or failed. `metadata` from the originating Check is combined later and will not be available until aXe reaches the reporting stage.
|
166
|
+
|
167
|
+
A CheckResult has the following properties:
|
168
|
+
|
169
|
+
- `id` - `String` The ID of the Check this CheckResult belongs to.
|
170
|
+
- `data` - `Mixed` Any data the Check's evaluate function added with `this.data()`. Typically used to insert data from analysis into a message or to perform further tests in the post-processing function.
|
171
|
+
- `relatedNodes` - `Array` Nodes that are related to the current Check as defined by [check.evaluate](#check-evaluate).
|
172
|
+
- `result` - `Boolean` The return value of [check.evaluate](#check-evaluate).
|
173
|
+
|
174
|
+
### Common Functions
|
175
|
+
|
176
|
+
Common functions are an internal library used by the rules and checks. If you have code repeated across rules and checks, you can use these functions and contribute to them. They are made available to every function as `commons`. Documentation is available in [source code](../lib/commons/).
|
177
|
+
|
178
|
+
#### Commons and Shadow DOM
|
179
|
+
|
180
|
+
To support open Shadow DOM while maintaining backwards compatibility, commons functions that
|
181
|
+
query DOM nodes must operate on an in-memory representation of the DOM using aXe-core’s
|
182
|
+
built-in [API methods and utility functions](./API.md#virtual-dom-utilities).
|
183
|
+
|
184
|
+
Commons functions should do the virtual tree lookup and call a `virtual` function
|
185
|
+
including the rest of the commons code. The naming of this special function
|
186
|
+
should contain the original commons function name with `Virtual` added to signify
|
187
|
+
it expects to operate on a virtual DOM tree.
|
188
|
+
|
189
|
+
Let’s look at an example:
|
190
|
+
|
191
|
+
```js
|
192
|
+
axe.commons.text.accessibleText = function(element, inLabelledbyContext) {
|
193
|
+
let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], element); // throws an exception on purpose if axe._tree not correct
|
194
|
+
return axe.commons.text.accessibleTextVirtual(
|
195
|
+
virtualNode,
|
196
|
+
inLabelledbyContext
|
197
|
+
);
|
198
|
+
};
|
199
|
+
|
200
|
+
axe.commons.text.accessibleTextVirtual = function(
|
201
|
+
element,
|
202
|
+
inLabelledbyContext
|
203
|
+
) {
|
204
|
+
// rest of the commons code minus the virtual tree lookup, since it’s passed in
|
205
|
+
};
|
206
|
+
```
|
207
|
+
|
208
|
+
`accessibleTextVirtual` would only be called directly if you’ve got a virtual node
|
209
|
+
you can use. If you don’t already have one, call the `accessibleText` lookup function,
|
210
|
+
which passes on a virtual DOM node with both the light DOM and Shadow DOM (if applicable).
|
211
|
+
|
212
|
+
### Virtual Nodes
|
213
|
+
|
214
|
+
To support open Shadow DOM, aXe-core has the ability to handle virtual nodes in [rule matches](#matches-function)
|
215
|
+
and [check evaluate](#check-evaluate) functions. The full set of API methods for Shadow DOM can be
|
216
|
+
found in the [API documentation](./API.md#virtual-dom-utilities), but the general
|
217
|
+
structure for a virtualNode is as follows:
|
218
|
+
|
219
|
+
```js
|
220
|
+
{
|
221
|
+
actualNode: <HTMLElement>,
|
222
|
+
children: <Array>,
|
223
|
+
shadowId: <String>
|
224
|
+
}
|
225
|
+
```
|
226
|
+
|
227
|
+
- A virtualNode is an object containing an HTML DOM element (`actualNode`).
|
228
|
+
- Children contains an array of child virtualNodes.
|
229
|
+
- The shadowID indicates whether the node is in an open shadow root and if it is, which one it is inside the boundary.
|
230
|
+
|
231
|
+
### Core Utilities
|
232
|
+
|
233
|
+
Core Utilities are an internal library that provides aXe with functionality used throughout its core processes. Most notably among these are the queue function and the DqElement constructor.
|
234
|
+
|
235
|
+
#### ARIA Lookup Tables
|
236
|
+
|
237
|
+
axe.commons.aria provides a namespace for ARIA-related utilities, including a lookupTable for attributes and roles.
|
238
|
+
|
239
|
+
- `axe.commons.aria.lookupTable.attributes`
|
240
|
+
- `axe.commons.aria.lookupTable.globalAttributes`
|
241
|
+
- `axe.commons.aria.lookupTable.role`
|
242
|
+
|
243
|
+
#### Common Utility Functions
|
244
|
+
|
245
|
+
In addition to the ARIA lookupTable, there are also utility functions on the axe.commons.aria and axe.commons.dom namespaces:
|
246
|
+
|
247
|
+
- `axe.commons.aria.implicitRole` - Get the implicit role for a given node
|
248
|
+
- `axe.commons.aria.label` - Gets the accessible ARIA label text of a given element
|
249
|
+
- `axe.commons.dom.isVisible` - Determine whether an element is visible
|
250
|
+
|
251
|
+
#### Queue Function
|
252
|
+
|
253
|
+
The queue function creates an asynchronous "queue", list of functions to be invoked in parallel, but not necessarily returned in order. The queue function returns an object with the following methods:
|
254
|
+
|
255
|
+
- `defer(func)` Defer a function that may or may not run asynchronously
|
256
|
+
- `then(callback)` The callback to execute once all "deferred" functions have completed. Will only be invoked once.
|
257
|
+
- `abort()` Abort the "queue" and prevent `then` function from firing
|
258
|
+
|
259
|
+
#### DqElement Class
|
260
|
+
|
261
|
+
The DqElement is a "serialized" `HTMLElement`. It will calculate the CSS selector, grab the source outerHTML and offer an array for storing frame paths. The DqElement class takes the following parameters:
|
262
|
+
|
263
|
+
- `Element` - `HTMLElement` The element to serialize
|
264
|
+
- `Spec` - `Object` Properties to use in place of the element when instantiated on Elements from other frames
|
265
|
+
|
266
|
+
```js
|
267
|
+
var firstH1 = document.getElementByTagName('h1')[0];
|
268
|
+
var dqH1 = new axe.utils.DqElement(firstH1);
|
269
|
+
```
|
270
|
+
|
271
|
+
Elements returned by the DqElement class have the following methods and properties:
|
272
|
+
|
273
|
+
- `selector` - `string` A unique CSS selector for the element
|
274
|
+
- `source` - `string` The generated HTML source code of the element
|
275
|
+
- `element` - `DOMNode` The element which this object is based off or the containing frame, used for sorting.
|
276
|
+
- `toJSON()` - Returns an object containing the selector and source properties
|
277
|
+
|
278
|
+
## Virtual DOM APIs
|
279
|
+
|
280
|
+
Note: You shouldn’t need the Shadow DOM APIs below unless you’re working on the axe-core
|
281
|
+
engine, as rules and checks already have `virtualNode` objects passed in. However, these APIs
|
282
|
+
will make it easier to work with the virtual DOM.
|
283
|
+
|
284
|
+
### API Name: axe.utils.getFlattenedTree
|
285
|
+
|
286
|
+
#### Description
|
287
|
+
|
288
|
+
Recursvely return an array containing the virtual DOM tree for the node specified, excluding comment nodes
|
289
|
+
and shadow DOM nodes `<content>` and `<slot>`. This method will return a flattened tree containing both
|
290
|
+
light and shadow DOM, if applicable.
|
291
|
+
|
292
|
+
#### Synopsis
|
293
|
+
|
294
|
+
```js
|
295
|
+
var element = document.body;
|
296
|
+
axe.utils.getFlattenedTree(element, shadowId);
|
297
|
+
```
|
298
|
+
|
299
|
+
#### Parameters
|
300
|
+
|
301
|
+
- `node` – HTMLElement. The current HTML node for which you want a flattened DOM tree.
|
302
|
+
- `shadowId` – string(optional). ID of the shadow DOM that is the closest shadow ancestor of the node
|
303
|
+
|
304
|
+
#### Returns
|
305
|
+
|
306
|
+
An array of objects, where each object is a virtualNode:
|
307
|
+
|
308
|
+
```js
|
309
|
+
[
|
310
|
+
{
|
311
|
+
actualNode: body,
|
312
|
+
children: [virtualNodes],
|
313
|
+
shadowId: undefined
|
314
|
+
}
|
315
|
+
];
|
316
|
+
```
|
317
|
+
|
318
|
+
### API Name: axe.utils.getNodeFromTree
|
319
|
+
|
320
|
+
#### Description
|
321
|
+
|
322
|
+
Recursively return a single node from a virtual DOM tree. This is commonly used in rules and checks where the node is readily available without querying the DOM.
|
323
|
+
|
324
|
+
#### Synopsis
|
325
|
+
|
326
|
+
```js
|
327
|
+
axe.utils.getNodeFromTree(axe._tree[0], node);
|
328
|
+
```
|
329
|
+
|
330
|
+
#### Parameters
|
331
|
+
|
332
|
+
- `vNode` – object. The flattened DOM tree to fetch a virtual node from
|
333
|
+
- `node` – HTMLElement. The HTML DOM node for which you need a virtual representation
|
334
|
+
|
335
|
+
#### Returns
|
336
|
+
|
337
|
+
A virtualNode object:
|
338
|
+
|
339
|
+
```js
|
340
|
+
{
|
341
|
+
actualNode: div,
|
342
|
+
children: [virtualNodes],
|
343
|
+
shadowId: undefined
|
344
|
+
}
|
345
|
+
```
|
346
|
+
|
347
|
+
## Test Utilities
|
348
|
+
|
349
|
+
All tests must support open Shadow DOM, so we created some test utilities to make this easier.
|
350
|
+
|
351
|
+
### Test Util Name: MockCheckContext
|
352
|
+
|
353
|
+
Create a check context for mocking and resetting data and relatedNodes in tests.
|
354
|
+
|
355
|
+
#### Synopsis
|
356
|
+
|
357
|
+
```js
|
358
|
+
describe('region', function() {
|
359
|
+
var fixture = document.getElementById('fixture');
|
360
|
+
|
361
|
+
var checkContext = new axe.testUtils.MockCheckContext();
|
362
|
+
|
363
|
+
afterEach(function() {
|
364
|
+
fixture.innerHTML = '';
|
365
|
+
checkContext.reset();
|
366
|
+
});
|
367
|
+
|
368
|
+
it('should return true when all content is inside the region', function() {
|
369
|
+
assert.isTrue(checks.region.evaluate.apply(checkContext, checkArgs));
|
370
|
+
assert.equal(checkContext._relatedNodes.length, 0);
|
371
|
+
});
|
372
|
+
});
|
373
|
+
```
|
374
|
+
|
375
|
+
#### Parameters
|
376
|
+
|
377
|
+
None
|
378
|
+
|
379
|
+
#### Returns
|
380
|
+
|
381
|
+
An object containg the data, relatedNodes, and a way to reset them.
|
382
|
+
|
383
|
+
```js
|
384
|
+
{
|
385
|
+
data: (){},
|
386
|
+
relatedNodes: (){},
|
387
|
+
reset: (){}
|
388
|
+
}
|
389
|
+
```
|
390
|
+
|
391
|
+
### Test Util Name: shadowSupport
|
392
|
+
|
393
|
+
Provides an API for determining Shadow DOM v0 and v1 support in tests. For example: PhantomJS doesn't have Shadow DOM support, while some browsers do.
|
394
|
+
|
395
|
+
#### Synopsis
|
396
|
+
|
397
|
+
```js
|
398
|
+
(axe.testUtils.shadowSupport.v1 ? it : xit)(
|
399
|
+
'should test Shadow tree content',
|
400
|
+
function() {
|
401
|
+
// The rest of the shadow DOM test
|
402
|
+
}
|
403
|
+
);
|
404
|
+
```
|
405
|
+
|
406
|
+
#### Parameters
|
407
|
+
|
408
|
+
None
|
409
|
+
|
410
|
+
#### Returns
|
411
|
+
|
412
|
+
An object containing booleans for the following Shadow DOM supports: `v0`, `v1`, or `undefined`.
|
413
|
+
|
414
|
+
### Test Util Name: fixtureSetup
|
415
|
+
|
416
|
+
Method for injecting content into a fixture and caching the flattened DOM tree (light and Shadow DOM together).
|
417
|
+
|
418
|
+
#### Synopsis
|
419
|
+
|
420
|
+
```js
|
421
|
+
it(
|
422
|
+
'should return true if there is only one ' +
|
423
|
+
type +
|
424
|
+
' element with the same name',
|
425
|
+
function() {
|
426
|
+
axe.testUtils.fixtureSetup(
|
427
|
+
'<input type="' +
|
428
|
+
type +
|
429
|
+
'" id="target" name="uniqueyname">' +
|
430
|
+
'<input type="' +
|
431
|
+
type +
|
432
|
+
'" name="differentname">'
|
433
|
+
);
|
434
|
+
|
435
|
+
var node = fixture.querySelector('#target');
|
436
|
+
assert.isTrue(check.evaluate.call(checkContext, node));
|
437
|
+
}
|
438
|
+
);
|
439
|
+
```
|
440
|
+
|
441
|
+
#### Parameters
|
442
|
+
|
443
|
+
- `content` – Node|String. Stuff to go into the fixture (html or DOM node)
|
444
|
+
|
445
|
+
#### Returns
|
446
|
+
|
447
|
+
An HTML Element for the fixture
|
448
|
+
|
449
|
+
### Test Util Name: checkSetup
|
450
|
+
|
451
|
+
Create check arguments.
|
452
|
+
|
453
|
+
#### Synopsis
|
454
|
+
|
455
|
+
```js
|
456
|
+
it('should return true when all content is inside the region', function() {
|
457
|
+
var checkArgs = checkSetup(
|
458
|
+
'<div id="target"><div role="main"><a href="a.html#mainheader">Click Here</a><div><h1 id="mainheader" tabindex="0">Introduction</h1></div></div></div>'
|
459
|
+
);
|
460
|
+
|
461
|
+
assert.isTrue(checks.region.evaluate.apply(checkContext, checkArgs));
|
462
|
+
assert.equal(checkContext._relatedNodes.length, 0);
|
463
|
+
});
|
464
|
+
```
|
465
|
+
|
466
|
+
#### Parameters
|
467
|
+
|
468
|
+
- `content` – String|Node. Stuff to go into the fixture (html or node)
|
469
|
+
- `options` – Object. Options argument for the check (optional, default: {})
|
470
|
+
- `target` – String. Target for the check, CSS selector (default: '#target')
|
471
|
+
|
472
|
+
#### Returns
|
473
|
+
|
474
|
+
An array with the DOM Node, options and virtualNode
|
475
|
+
|
476
|
+
```js
|
477
|
+
[node, options, virtualNode];
|
478
|
+
```
|
479
|
+
|
480
|
+
## Using Rule Generation CLI
|
481
|
+
|
482
|
+
Axe provides a CLI for generating the necessary files and configuration assets for authoring a rule.
|
483
|
+
|
484
|
+
To invoke the rule generator, run:
|
485
|
+
|
486
|
+
```sh
|
487
|
+
npm run rule-gen
|
488
|
+
```
|
489
|
+
|
490
|
+
The CLI acts a wizard, by asking a series of questions related to generation of the rule, for example:
|
491
|
+
|
492
|
+
```sh
|
493
|
+
- What is the name of the RULE? (Eg: aria-valid): sample-rule
|
494
|
+
- Does the RULE need a MATCHES file to be created?: Yes
|
495
|
+
- Would you like to create a CHECK for the RULE?: No
|
496
|
+
- Would you like to create UNIT test files? Yes
|
497
|
+
- Would you like to create INTEGRATION test files? Yes
|
498
|
+
```
|
499
|
+
|
500
|
+
Upon answering of which the the assets are created in the respective directories.
|