Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: convert accessibility audits #6229

Merged
merged 3 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/accesskeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if the accesskey HTML attribute values are unique across all elements. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[accesskey]` values are unique',
/** Title of an accesibility audit that evaluates if the accesskey HTML attribute values are unique across all elements. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[accesskey]` values are not unique',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Access keys let users quickly focus a part of the page. For proper ' +
'navigation, each access key must be unique. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/accesskeys?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class Accesskeys extends AxeAudit {
/**
Expand All @@ -19,14 +33,13 @@ class Accesskeys extends AxeAudit {
static get meta() {
return {
id: 'accesskeys',
title: '`[accesskey]` values are unique',
failureTitle: '`[accesskey]` values are not unique',
description: 'Access keys let users quickly focus a part of the page. For proper ' +
'navigation, each access key must be unique. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/accesskeys?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = Accesskeys;
module.exports.UIStrings = UIStrings;
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/aria-allowed-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if the ARIA HTML attributes are misaligned with the aria-role HTML attribute specificed on the element, such mismatches are invalid. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[aria-*]` attributes match their roles',
/** Title of an accesibility audit that evaluates if the ARIA HTML attributes are misaligned with the aria-role HTML attribute specificed on the element, such mismatches are invalid. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[aria-*]` attributes do not match their roles',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more details calling out what the ARIA attributes are? Might be confusing.

Note: This happens a lot, and I wonder if just saying ARIA, or aria-elements is sufficient in all places with no context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add it to our separate definitions glossary? @paulirish @brendankenny that was a thing right I'm not making that up :)

description: 'Each ARIA `role` supports a specific subset of `aria-*` attributes. ' +
'Mismatching these invalidates the `aria-*` attributes. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-allowed-attr?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class ARIAAllowedAttr extends AxeAudit {
/**
Expand All @@ -19,14 +33,13 @@ class ARIAAllowedAttr extends AxeAudit {
static get meta() {
return {
id: 'aria-allowed-attr',
title: '`[aria-*]` attributes match their roles',
failureTitle: '`[aria-*]` attributes do not match their roles',
description: 'Each ARIA `role` supports a specific subset of `aria-*` attributes. ' +
'Mismatching these invalidates the `aria-*` attributes. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-allowed-attr?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = ARIAAllowedAttr;
module.exports.UIStrings = UIStrings;
21 changes: 17 additions & 4 deletions lighthouse-core/audits/accessibility/aria-required-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if all elements with the aria-role attribute have the other corresponding ARIA attributes set as well. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[role]`s have all required `[aria-*]` attributes',
/** Title of an accesibility audit that evaluates if all elements with the aria-role attribute have the other corresponding ARIA attributes set as well. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[role]`s do not have all required `[aria-*]` attributes',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Some ARIA roles have required attributes that describe the state ' +
'of the element to screen readers. [Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-attr?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class ARIARequiredAttr extends AxeAudit {
/**
Expand All @@ -19,13 +32,13 @@ class ARIARequiredAttr extends AxeAudit {
static get meta() {
return {
id: 'aria-required-attr',
title: '`[role]`s have all required `[aria-*]` attributes',
failureTitle: '`[role]`s do not have all required `[aria-*]` attributes',
description: 'Some ARIA roles have required attributes that describe the state ' +
'of the element to screen readers. [Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-attr?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = ARIARequiredAttr;
module.exports.UIStrings = UIStrings;
25 changes: 19 additions & 6 deletions lighthouse-core/audits/accessibility/aria-required-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if the elements with an aria-role that require child elements have the required children. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: 'Elements with `[role]` that require specific children `[role]`s, are present',
/** Title of an accesibility audit that evaluates if the elements with an aria-role that require child elements have the required children. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: 'Elements with `[role]` that require specific children `[role]`s, ' +
'are missing.',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Some ARIA parent roles must contain specific child roles to perform ' +
'their intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-children?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AriaRequiredChildren extends AxeAudit {
/**
Expand All @@ -20,15 +35,13 @@ class AriaRequiredChildren extends AxeAudit {
static get meta() {
return {
id: 'aria-required-children',
title: 'Elements with `[role]` that require specific children `[role]`s, are present',
failureTitle: 'Elements with `[role]` that require specific children `[role]`s, ' +
'are missing.',
description: 'Some ARIA parent roles must contain specific child roles to perform ' +
'their intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-children?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = AriaRequiredChildren;
module.exports.UIStrings = UIStrings;
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/aria-required-parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates valid aria-role usage. Some ARIA roles require that elements must be a child of specific parent element. This audit checks that when those roles are used, the element with the role is in fact a child of the required parent. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[role]`s are contained by their required parent element',
/** Title of an accesibility audit that evaluates valid aria-role usage. Some ARIA roles require that elements must be a child of specific parent element. This audit checks that when those roles are used, the element with the role is in fact a child of the required parent. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[role]`s are not contained by their required parent element',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Some ARIA child roles must be contained by specific parent roles to ' +
'properly perform their intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-parent?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AriaRequiredParent extends AxeAudit {
/**
Expand All @@ -20,14 +34,13 @@ class AriaRequiredParent extends AxeAudit {
static get meta() {
return {
id: 'aria-required-parent',
title: '`[role]`s are contained by their required parent element',
failureTitle: '`[role]`s are not contained by their required parent element',
description: 'Some ARIA child roles must be contained by specific parent roles to ' +
'properly perform their intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-required-parent?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = AriaRequiredParent;
module.exports.UIStrings = UIStrings;
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/aria-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if all elements have valid aria-role HTML attributes. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[role]` values are valid',
/** Title of an accesibility audit that evaluates if all elements have valid aria-role HTML attributes. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[role]` values are not valid',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'ARIA roles must have valid values in order to perform their ' +
'intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-roles?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AriaRoles extends AxeAudit {
/**
Expand All @@ -19,14 +33,13 @@ class AriaRoles extends AxeAudit {
static get meta() {
return {
id: 'aria-roles',
title: '`[role]` values are valid',
failureTitle: '`[role]` values are not valid',
description: 'ARIA roles must have valid values in order to perform their ' +
'intended accessibility functions. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/aria-roles?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = AriaRoles;
module.exports.UIStrings = UIStrings;
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/aria-valid-attr-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if all elements that have an ARIA HTML attribute have a valid value for that attribute. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[aria-*]` attributes have valid values',
/** Title of an accesibility audit that evaluates if all elements that have an ARIA HTML attribute have a valid value for that attribute. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[aria-*]` attributes do not have valid values',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
'attributes with invalid values. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-valid-attr-value?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class ARIAValidAttr extends AxeAudit {
/**
Expand All @@ -19,14 +33,13 @@ class ARIAValidAttr extends AxeAudit {
static get meta() {
return {
id: 'aria-valid-attr-value',
title: '`[aria-*]` attributes have valid values',
failureTitle: '`[aria-*]` attributes do not have valid values',
description: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
'attributes with invalid values. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-valid-attr-value?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = ARIAValidAttr;
module.exports.UIStrings = UIStrings;
23 changes: 18 additions & 5 deletions lighthouse-core/audits/accessibility/aria-valid-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if all elements with ARIA HTML attributes have spelled the name of attribute correctly. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`[aria-*]` attributes are valid and not misspelled',
/** Title of an accesibility audit that evaluates if all elements with ARIA HTML attributes have spelled the name of attribute correctly. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`[aria-*]` attributes are not valid or misspelled',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
'attributes with invalid names. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-valid-attr?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class ARIAValidAttr extends AxeAudit {
/**
Expand All @@ -19,14 +33,13 @@ class ARIAValidAttr extends AxeAudit {
static get meta() {
return {
id: 'aria-valid-attr',
title: '`[aria-*]` attributes are valid and not misspelled',
failureTitle: '`[aria-*]` attributes are not valid or misspelled',
description: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
'attributes with invalid names. [Learn ' +
'more](https://dequeuniversity.com/rules/axe/2.2/aria-valid-attr?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = ARIAValidAttr;
module.exports.UIStrings = UIStrings;
27 changes: 20 additions & 7 deletions lighthouse-core/audits/accessibility/audio-caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
*/

const AxeAudit = require('./axe-audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of an accesibility audit that evaluates if all audio elements have a track element that has captions for screen readers. This title is descriptive of the successful state and is shown to users when no user action is required. */
title: '`<audio>` elements contain a `<track>` element with `[kind="captions"]`',
/** Title of an accesibility audit that evaluates if all audio elements have a track element that has captions for screen readers. This title is descriptive of the failing state and is shown to users when there is a failure that needs to be addressed. */
failureTitle: '`<audio>` elements are missing a `<track>` element with ' +
'`[kind="captions"]`.',
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Captions make audio elements usable for deaf or hearing-impaired users, ' +
'providing critical information such as who is talking, what they\'re saying, ' +
'and other non-speech information. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/audio-caption?application=lighthouse).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AudioCaption extends AxeAudit {
/**
Expand All @@ -19,16 +35,13 @@ class AudioCaption extends AxeAudit {
static get meta() {
return {
id: 'audio-caption',
title: '`<audio>` elements contain a `<track>` element with `[kind="captions"]`',
failureTitle: '`<audio>` elements are missing a `<track>` element with ' +
'`[kind="captions"]`.',
description: 'Captions make audio elements usable for deaf or hearing-impaired users, ' +
'providing critical information such as who is talking, what they\'re saying, ' +
'and other non-speech information. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/audio-caption?application=lighthouse).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Accessibility'],
};
}
}

module.exports = AudioCaption;
module.exports.UIStrings = UIStrings;
Loading