UNPKG

@uuv/a11y

Version:

A javascript lib for running a11y validation based on multiple reference(RGAA, etc)

619 lines (618 loc) 25.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const model_1 = require("../../../model"); const query_1 = require("../../../query"); const selector_helper_1 = require("../selector-helper"); const by_sibling_query_1 = require("../../../query/by-sibling.query"); exports.default = [ model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.1", elementType: "image", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ selector_helper_1.informativeContent.image.SELECTOR ]), true), description: "image has no text information", help: "set text information to image" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.1", elementType: "image", query: new query_1.AccessibleNameQuery(new query_1.ByRoleQuery("img", [], ["object", "svg", "embed", "canvas"]), true), description: "image has no text information", help: "set text information to image" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.2", elementType: "area", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ selector_helper_1.informativeContent.area.SELECTOR ]), true), description: "area has no alternative text", help: "set alternative text to area" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.3", elementType: "input", query: new query_1.CompliantAttributesQuery(new query_1.ByTagQuery([ selector_helper_1.informativeContent.input.SELECTOR ]), [ query_1.AttributeChecker.emptyAttribute("alt"), query_1.AttributeChecker.emptyAttribute("aria-label"), query_1.AttributeChecker.emptyAttribute("title"), query_1.AttributeChecker.emptyHtmlNodeTargetedByTheAttribute("aria-labelledBy") ]), description: "input with image type has no alternative text", help: "set alternative text to input with image type" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.4", elementType: "image", query: new query_1.ByTagQuery([ "a[href]img[ismap]" ]), description: "The clickable zone does not have an identical mechanism, which can be used regardless of the pointing device used and provides access to the same destination", help: "provide a mechanism identical to the clickable zone, which can be used regardless of the pointing device used and provides access to the same destination" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.5", elementType: "svg", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ selector_helper_1.informativeContent.svg.SELECTOR ]), true), description: "svg has no alternative text", help: "set alternative text to svg" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.5", elementType: "svg", query: new query_1.ByTagQuery([ "svg:not([role=img])" ]), description: "svg has no image role", help: "set image role to svg" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.6", elementType: "object", query: new query_1.ByTagQuery([`${selector_helper_1.informativeContent.object.SELECTOR}:not([role=img])`]), description: "object has no role image", help: "add role image" }), model_1.AutoCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.6", elementType: "object", query: query_1.OperatorQuery.And(new query_1.AccessibleNameQuery(new query_1.ByTagQuery([`${selector_helper_1.informativeContent.object.SELECTOR}[role=img]`]), true), new by_sibling_query_1.BySiblingQuery(new query_1.ByTagQuery([`${selector_helper_1.informativeContent.object.SELECTOR}[role=img]`]), false, [selector_helper_1.siblingElement.button.SELECTOR, "a"])), description: "object has no alternative text", help: "domNode corresponds to the object node and linkedNodes corresponds to the nodes to be analysed" }), model_1.ManualCheckA11yRule.from({ criterion: "1.1", wcag: "1.1.1 A", id: "1.1.6", elementType: "object", query: query_1.OperatorQuery.And(new query_1.AccessibleNameQuery(new query_1.ByTagQuery([`${selector_helper_1.informativeContent.object.SELECTOR}[role=img]`]), true), new by_sibling_query_1.BySiblingQuery(new query_1.ByTagQuery([`${selector_helper_1.informativeContent.object.SELECTOR}[role=img]`]), true, [selector_helper_1.siblingElement.button.SELECTOR, "a"])), description: "object has sibling elements to check", help: "domNode corresponds to the object node and linkedNodes corresponds to the nodes to be analysed" }), // AutoCheckA11yRule.from({ // // criterion: "1.1", // wcag: "1.1.1 A", // id: "1.1.7", // elementType: "embed", // query: new AccessibleNameQuery(new ByTagQuery([ // informativeContent.embed.SELECTOR // ]), true), // description: "embed has no image role or no alternative text", // help: "set image role to embed and alternative text" // }), // AutoCheckA11yRule.from({ // // criterion: "1.1", // wcag: "1.1.1 A", // id: "1.1.8", // elementType: "canvas", // query: new AccessibleNameQuery(new ByTagQuery([ // "canvas[role=img]" // ]), true), // description: "canvas has no image role and no alternative text", // help: "set image role to canvas and alternative text" // }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.1", elementType: "image", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "img[alt='']:not([href])", "img[aria-hidden=true]:not([href]", "img[role=presentation]:not([href])" ]), false), description: "decorative image has alternative text", help: "remove alternative text to decorative image" }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.2", elementType: "area", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "area[alt='']:not([href])", "area[aria-hidden=true]:not([href]", "area[role=presentation]:not([href])" ]), false), description: "decorative area has alternative text", help: "remove alternative text to decorative area" }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.3", elementType: "object", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "object[aria-hidden=true]" ]), false), description: "decorative object has alternative text", help: "remove alternative text to decorative object" }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.4", elementType: "svg", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "svg[aria-hidden=true][title]:not([title=''])", "svg[aria-hidden=true][desc]:not([desc=''])" ]), false), description: "decorative svg has alternative text", help: "remove alternative text to decorative svg" }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.5", elementType: "canvas", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "canvas[aria-hidden=true]" ]), false), description: "decorative canvas has alternative text", help: "remove alternative text to decorative canvas" }), model_1.AutoCheckA11yRule.from({ criterion: "1.2", wcag: "1.1.1 A, 4.1.2 A", id: "1.2.6", elementType: "embed", query: new query_1.AccessibleNameQuery(new query_1.ByTagQuery([ "embed[aria-hidden=true]" ]), false), description: "decorative embed has alternative text", help: "remove alternative text to decorative embed" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.1", elementType: "image", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.image.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.image.ATTRIBUTES, description: "if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.1", elementType: "image", query: new query_1.ByRoleQuery("img", selector_helper_1.informativeContent.image.ATTRIBUTES), attributes: selector_helper_1.informativeContent.image.ATTRIBUTES, description: "if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.2", elementType: "area", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.area.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.area.ATTRIBUTES, description: "if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.3", elementType: "input", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.input.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.input.ATTRIBUTES, description: "if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.4", elementType: "object", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.object.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.object.ATTRIBUTES, description: "if present, attributes title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.5", elementType: "embed", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.embed.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.embed.ATTRIBUTES, description: "if present, attributes title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.6", elementType: "svg", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.svg.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.svg.ATTRIBUTES, description: "if present, attributes title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.7", elementType: "canvas", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.canvas.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.canvas.ATTRIBUTES, description: "if present, attributes title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.9", elementType: "polymorph", query: new query_1.ByTagQuery([ ...selector_helper_1.informativeContent.image.buildSelectorWithAttributes(), ...selector_helper_1.informativeContent.area.buildSelectorWithAttributes(), ...selector_helper_1.informativeContent.input.buildSelectorWithAttributes() ]), attributes: [ "title", "aria-labelledby", "aria-label", "alt" ], description: "if present, attributes alt, title, aria-label, aria-labelledby must contain short and concise information", help: "adapt these attributes to be short and concise" }), model_1.ManualCheckA11yRule.from({ criterion: "1.3", wcag: "4.1.2 A", id: "1.3.9", elementType: "polymorph", query: new query_1.ByTagQuery([ ...selector_helper_1.informativeContent.object.buildSelectorWithAttributes(), ...selector_helper_1.informativeContent.embed.buildSelectorWithAttributes(), ...selector_helper_1.informativeContent.svg.buildSelectorWithAttributes(), ...selector_helper_1.informativeContent.canvas.buildSelectorWithAttributes() ]), attributes: [ "title", "aria-labelledby", "aria-label" ], description: "if present, attributes title, aria-label, aria-labelledby must contain short and concise information", help: "adapt these attributes to be short and concise" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.1", elementType: "image", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.image.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.image.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.2", elementType: "area", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.area.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.area.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.3", elementType: "input", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.input.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.input.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.4", elementType: "object", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.object.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.object.ATTRIBUTES, description: "For captcha or image-test, if present, attributes, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.5", elementType: "embed", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.embed.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.embed.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.6", elementType: "svg", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.svg.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.svg.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.4", wcag: "1.1.1 A", id: "1.4.7", elementType: "canvas", query: new query_1.ByTagQuery(selector_helper_1.informativeContent.canvas.buildSelectorWithAttributes()), attributes: selector_helper_1.informativeContent.canvas.ATTRIBUTES, description: "For captcha or image-test, if present, attributes alt, title, aria-label, aria-labelledby must be relevant", help: "adapt these attributes to be relevant" }), model_1.ManualCheckA11yRule.from({ criterion: "1.5", wcag: "1.1.1 A", id: "1.5.1", elementType: "polymorph", query: new query_1.ByTagQuery([ "img", "area", "object", "embed", "svg", "canvas" ]), description: "There is an alternative access solution to the content or function of the CAPTCHA", help: "Add an alternative access solution" }), model_1.ManualCheckA11yRule.from({ criterion: "1.5", wcag: "1.1.1 A", id: "1.5.1", elementType: "image", query: new query_1.ByRoleQuery("img"), description: "There is an alternative access solution to the content or function of the CAPTCHA", help: "Add an alternative access solution" }), model_1.ManualCheckA11yRule.from({ criterion: "1.5", wcag: "1.1.1 A", id: "1.5.2", elementType: "input", query: new query_1.ByTagQuery([ selector_helper_1.informativeContent.input.SELECTOR ]), description: "There is an alternative access solution to the content or function of the CAPTCHA", help: "Add an alternative access solution" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.1", elementType: "image", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.image.SELECTOR}[longdesc]` ]), attributes: [ "longdesc" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.1", elementType: "image", query: new query_1.ByRoleQuery("img", [ "longdesc" ]), attributes: [ "longdesc" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.2", elementType: "object", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.object.SELECTOR}[longdesc]` ]), attributes: [ "longdesc" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.3", elementType: "embed", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.embed.SELECTOR}[longdesc]` ]), attributes: [ "longdesc" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.4", elementType: "input", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.input.SELECTOR}[longdesc]` ]), attributes: [ "aria-describedby" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.5", elementType: "svg", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-describedby]`, `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-labelledby]` ]), attributes: [ "aria-describedby", "aria-labelledby" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.6", elementType: "svg", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-describedby]`, `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-labelledby]`, `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-label]` ]), attributes: [ "aria-describedby", "aria-labelledby", "aria-label" ], description: "if description in attribute, the description must be correctly rendered by assistive technologies", help: "render description by assistive technologies" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.7", elementType: "svg", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.svg.SELECTOR}[aria-labelledby]` ]), attributes: [ "aria-labelledby" ], description: "the description must be relevant", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.8", elementType: "canvas", query: new query_1.ByTagQuery([ `${selector_helper_1.informativeContent.canvas.SELECTOR}[aria-describedby]`, `${selector_helper_1.informativeContent.canvas.SELECTOR}[aria-labelledby]`, `${selector_helper_1.informativeContent.canvas.SELECTOR}[aria-label]` ]), attributes: [ "aria-describedby", "aria-labelledby", "aria-label" ], description: "if description in attribute, the description must be correctly rendered by assistive technologies", help: "render description by assistive technologies" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.9", elementType: "polymorph", query: new query_1.ByTagQuery([ "img[alt][aria-describedby]", "input[type^=image][aria-describedby]", "area[alt][aria-describedby]", "object[type^=image][aria-describedby]", "embed[type^=image][aria-describedby]", "svg[aria-describedby]", "canvas[aria-describedby]" ]), attributes: [ "aria-describedby" ], description: "does the WAI-ARIA attribute aria-describedby associate with the detailed description?", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.9", elementType: "polymorph", query: new query_1.ByRoleQuery("img", [ "alt", "aria-describedby" ]), attributes: [ "aria-describedby" ], description: "does the WAI-ARIA attribute aria-describedby associate with the detailed description?", help: "adapt the description" }), model_1.ManualCheckA11yRule.from({ criterion: "1.6", wcag: "1.1.1 A", id: "1.6.10", elementType: "polymorph", query: new query_1.ByRoleQuery("img", [ "alt", "aria-describedby" ]), attributes: [ "aria-describedby" ], description: "does the WAI-ARIA attribute aria-describedby associate with the detailed description?", help: "adapt the description" }) ];