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

core(audit): align meta properties with LHR #5540

Merged
merged 4 commits into from Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Expand Up @@ -45,10 +45,10 @@ If you have a contribution for our [documentation](https://developers.google.com
1. Ensure that your code adheres to the existing style in the sample to which you are contributing.
1. Submit a pull request.

## helpText guidelines
## description guidelines

Keep the `helpText` of an audit as short as possible. When a reference doc for the audit exists on
developers.google.com/web, the `helpText` should only explain *why* the user should care
Keep the `description` of an audit as short as possible. When a reference doc for the audit exists on
developers.google.com/web, the `description` should only explain *why* the user should care
about the audit, not *how* to fix it.

Do:
Expand All @@ -61,7 +61,7 @@ Don't:
Serve images that are smaller than the user's viewport to save cellular data and
improve load time. Consider using responsive images and client hints.

If no reference doc exists yet, then you can use the `helpText` as a stopgap for explaining
If no reference doc exists yet, then you can use the `description` as a stopgap for explaining
both why the audit is important and how to fix it.

## Tracking Errors
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture.md
Expand Up @@ -15,9 +15,9 @@ _Some incomplete notes_

### Audit/Report terminology
* **Category** - Roll-up collection of audits and audit groups into a user-facing section of the report (eg. `Best Practices`). Applies weighting and overall scoring to the section. Examples: PWA, Accessibility, Best Practices.
* **Audit description** - Short user-visible title for the successful audit. eg. “All image elements have `[alt]` attributes.”
* **Audit failure description** - Short user-visible title for a failing audit. eg. “Some image elements do not have `[alt]` attributes.”
* **Audit help text** - Explanation of why the user should care about the audit. Not necessarily how to fix it, unless there is no external link that explains it. ([See helpText guidelines](CONTRIBUTING.md#helptext-guidelines)). eg. “Informative elements should aim for short, descriptive alternate text. Decorative elements can be ignored with an empty alt attribute. [Learn more].”
* **Audit title** - Short user-visible title for the successful audit. eg. “All image elements have `[alt]` attributes.”
* **Audit failure title** - Short user-visible title for a failing audit. eg. “Some image elements do not have `[alt]` attributes.”
Copy link
Member

Choose a reason for hiding this comment

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

should we change it to **Audit failureTitle** just to be crystal clear it's that property name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

* **Audit description** - Explanation of why the user should care about the audit. Not necessarily how to fix it, unless there is no external link that explains it. ([See description guidelines](CONTRIBUTING.md#description-guidelines)). eg. “Informative elements should aim for short, descriptive alternate text. Decorative elements can be ignored with an empty alt attribute. [Learn more].”

## Protocol

Expand Down
8 changes: 4 additions & 4 deletions docs/recipes/custom-audit/searchable-audit.js
Expand Up @@ -17,10 +17,10 @@ const MAX_SEARCHABLE_TIME = 4000;
class LoadAudit extends Audit {
static get meta() {
return {
name: 'searchable-audit',
description: 'Search box initialized and ready',
failureDescription: 'Search box slow to initialize',
helpText: 'Used to measure time from navigationStart to when the search' +
id: 'searchable-audit',
title: 'Search box initialized and ready',
failureTitle: 'Search box slow to initialize',
description: 'Used to measure time from navigationStart to when the search' +
' box is initialized and ready to search.',

// The name of the custom gatherer class that provides input to this audit.
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/accesskeys.js
Expand Up @@ -18,10 +18,10 @@ class Accesskeys extends AxeAudit {
*/
static get meta() {
return {
name: 'accesskeys',
description: '`[accesskey]` values are unique',
failureDescription: '`[accesskey]` values are not unique',
helpText: 'Access keys let users quickly focus a part of the page. For proper ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-allowed-attr.js
Expand Up @@ -18,10 +18,10 @@ class ARIAAllowedAttr extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-allowed-attr',
description: '`[aria-*]` attributes match their roles',
failureDescription: '`[aria-*]` attributes do not match their roles',
helpText: 'Each ARIA `role` supports a specific subset of `aria-*` attributes. ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-required-attr.js
Expand Up @@ -18,10 +18,10 @@ class ARIARequiredAttr extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-required-attr',
description: '`[role]`s have all required `[aria-*]` attributes',
failureDescription: '`[role]`s do not have all required `[aria-*]` attributes',
helpText: 'Some ARIA roles have required attributes that describe the state ' +
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).',
requiredArtifacts: ['Accessibility'],
};
Expand Down
Expand Up @@ -19,11 +19,11 @@ class AriaRequiredChildren extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-required-children',
description: 'Elements with `[role]` that require specific children `[role]`s, are present',
failureDescription: 'Elements with `[role]` that require specific children `[role]`s, ' +
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.',
helpText: 'Some ARIA parent roles must contain specific child roles to perform ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-required-parent.js
Expand Up @@ -19,10 +19,10 @@ class AriaRequiredParent extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-required-parent',
description: '`[role]`s are contained by their required parent element',
failureDescription: '`[role]`s are not contained by their required parent element',
helpText: 'Some ARIA child roles must be contained by specific parent roles to ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-roles.js
Expand Up @@ -18,10 +18,10 @@ class AriaRoles extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-roles',
description: '`[role]` values are valid',
failureDescription: '`[role]` values are not valid',
helpText: 'ARIA roles must have valid values in order to perform their ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-valid-attr-value.js
Expand Up @@ -18,10 +18,10 @@ class ARIAValidAttr extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-valid-attr-value',
description: '`[aria-*]` attributes have valid values',
failureDescription: '`[aria-*]` attributes do not have valid values',
helpText: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/aria-valid-attr.js
Expand Up @@ -18,10 +18,10 @@ class ARIAValidAttr extends AxeAudit {
*/
static get meta() {
return {
name: 'aria-valid-attr',
description: '`[aria-*]` attributes are valid and not misspelled',
failureDescription: '`[aria-*]` attributes are not valid or misspelled',
helpText: 'Assistive technologies, like screen readers, can\'t interpret ARIA ' +
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).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/audio-caption.js
Expand Up @@ -18,11 +18,11 @@ class AudioCaption extends AxeAudit {
*/
static get meta() {
return {
name: 'audio-caption',
description: '`<audio>` elements contain a `<track>` element with `[kind="captions"]`',
failureDescription: '`<audio>` elements are missing a `<track>` element with ' +
id: 'audio-caption',
title: '`<audio>` elements contain a `<track>` element with `[kind="captions"]`',
failureTitle: '`<audio>` elements are missing a `<track>` element with ' +
'`[kind="captions"]`.',
helpText: 'Captions make audio elements usable for deaf or hearing-impaired users, ' +
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).',
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/accessibility/axe-audit.js
Expand Up @@ -23,7 +23,7 @@ class AxeAudit extends Audit {
// This means aXe did not find any nodes which matched these checks.
// Note in Lighthouse we use the phrasing "Not Applicable" (aXe uses "inapplicable", which sounds weird).
const notApplicables = artifacts.Accessibility.notApplicable || [];
const isNotApplicable = notApplicables.find(result => result.id === this.meta.name);
const isNotApplicable = notApplicables.find(result => result.id === this.meta.id);
if (isNotApplicable) {
return {
rawValue: true,
Expand All @@ -32,7 +32,7 @@ class AxeAudit extends Audit {
}

const violations = artifacts.Accessibility.violations || [];
const rule = violations.find(result => result.id === this.meta.name);
const rule = violations.find(result => result.id === this.meta.id);
const impact = rule && rule.impact;
const tags = rule && rule.tags;

Expand Down
10 changes: 5 additions & 5 deletions lighthouse-core/audits/accessibility/button-name.js
Expand Up @@ -18,11 +18,11 @@ class ButtonName extends AxeAudit {
*/
static get meta() {
return {
name: 'button-name',
description: 'Buttons have an accessible name',
failureDescription: 'Buttons do not have an accessible name',
helpText: 'When a button doesn\'t have an accessible name, screen readers announce it as ' +
'"button", making it unusable for users who rely on screen readers. ' +
id: 'button-name',
title: 'Buttons have an accessible name',
failureTitle: 'Buttons do not have an accessible name',
description: 'When a button doesn\'t have an accessible name, screen readers announce it ' +
'as "button", making it unusable for users who rely on screen readers. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/button-name?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
};
Expand Down
10 changes: 5 additions & 5 deletions lighthouse-core/audits/accessibility/bypass.js
Expand Up @@ -19,11 +19,11 @@ class Bypass extends AxeAudit {
*/
static get meta() {
return {
name: 'bypass',
description: 'The page contains a heading, skip link, or landmark region',
failureDescription: 'The page does not contain a heading, skip link, or landmark region',
helpText: 'Adding ways to bypass repetitive content lets keyboard users navigate the page ' +
'more efficiently. ' +
id: 'bypass',
title: 'The page contains a heading, skip link, or landmark region',
failureTitle: 'The page does not contain a heading, skip link, or landmark region',
description: 'Adding ways to bypass repetitive content lets keyboard users navigate the ' +
'page more efficiently. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/bypass?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
};
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/color-contrast.js
Expand Up @@ -19,11 +19,11 @@ class ColorContrast extends AxeAudit {
*/
static get meta() {
return {
name: 'color-contrast',
description: 'Background and foreground colors have a sufficient contrast ratio',
failureDescription: 'Background and foreground colors do not have a ' +
id: 'color-contrast',
title: 'Background and foreground colors have a sufficient contrast ratio',
failureTitle: 'Background and foreground colors do not have a ' +
'sufficient contrast ratio.',
helpText: 'Low-contrast text is difficult or impossible for many users to read. ' +
description: 'Low-contrast text is difficult or impossible for many users to read. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/color-contrast?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
};
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/definition-list.js
Expand Up @@ -18,12 +18,12 @@ class DefinitionList extends AxeAudit {
*/
static get meta() {
return {
name: 'definition-list',
description: '`<dl>`\'s contain only properly-ordered `<dt>` and `<dd>` groups, `<script>` ' +
id: 'definition-list',
title: '`<dl>`\'s contain only properly-ordered `<dt>` and `<dd>` groups, `<script>` ' +
'or `<template>` elements.',
failureDescription: '`<dl>`\'s do not contain only properly-ordered `<dt>` and `<dd>` ' +
failureTitle: '`<dl>`\'s do not contain only properly-ordered `<dt>` and `<dd>` ' +
'groups, `<script>` or `<template>` elements.',
helpText: 'When definition lists are not properly marked up, screen readers may produce ' +
description: 'When definition lists are not properly marked up, screen readers may produce ' +
'confusing or inaccurate output. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/definition-list?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/dlitem.js
Expand Up @@ -18,10 +18,10 @@ class DLItem extends AxeAudit {
*/
static get meta() {
return {
name: 'dlitem',
description: 'Definition list items are wrapped in `<dl>` elements',
failureDescription: 'Definition list items are not wrapped in `<dl>` elements',
helpText: 'Definition list items (`<dt>` and `<dd>`) must be wrapped in a ' +
id: 'dlitem',
title: 'Definition list items are wrapped in `<dl>` elements',
failureTitle: 'Definition list items are not wrapped in `<dl>` elements',
description: 'Definition list items (`<dt>` and `<dd>`) must be wrapped in a ' +
'parent `<dl>` element to ensure that screen readers can properly announce them. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/dlitem?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/document-title.js
Expand Up @@ -18,10 +18,10 @@ class DocumentTitle extends AxeAudit {
*/
static get meta() {
return {
name: 'document-title',
description: 'Document has a `<title>` element',
failureDescription: 'Document doesn\'t have a `<title>` element',
helpText: 'The title gives screen reader users an overview of the page, and search ' +
id: 'document-title',
title: 'Document has a `<title>` element',
failureTitle: 'Document doesn\'t have a `<title>` element',
description: 'The title gives screen reader users an overview of the page, and search ' +
'engine users rely on it heavily to determine if a page is relevant to their search. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/title).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/duplicate-id.js
Expand Up @@ -18,10 +18,10 @@ class DuplicateId extends AxeAudit {
*/
static get meta() {
return {
name: 'duplicate-id',
description: '`[id]` attributes on the page are unique',
failureDescription: '`[id]` attributes on the page are not unique',
helpText: 'The value of an id attribute must be unique to prevent ' +
id: 'duplicate-id',
title: '`[id]` attributes on the page are unique',
failureTitle: '`[id]` attributes on the page are not unique',
description: 'The value of an id attribute must be unique to prevent ' +
'other instances from being overlooked by assistive technologies. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/duplicate-id?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/frame-title.js
Expand Up @@ -18,10 +18,10 @@ class FrameTitle extends AxeAudit {
*/
static get meta() {
return {
name: 'frame-title',
description: '`<frame>` or `<iframe>` elements have a title',
failureDescription: '`<frame>` or `<iframe>` elements do not have a title',
helpText: 'Screen reader users rely on frame titles to describe the contents of frames. ' +
id: 'frame-title',
title: '`<frame>` or `<iframe>` elements have a title',
failureTitle: '`<frame>` or `<iframe>` elements do not have a title',
description: 'Screen reader users rely on frame titles to describe the contents of frames. ' +
'[Learn more](https://dequeuniversity.com/rules/axe/2.2/frame-title?application=lighthouse).',
requiredArtifacts: ['Accessibility'],
};
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/audits/accessibility/html-has-lang.js
Expand Up @@ -18,10 +18,10 @@ class HTMLHasLang extends AxeAudit {
*/
static get meta() {
return {
name: 'html-has-lang',
description: '`<html>` element has a `[lang]` attribute',
failureDescription: '`<html>` element does not have a `[lang]` attribute',
helpText: 'If a page doesn\'t specify a lang attribute, a screen reader assumes ' +
id: 'html-has-lang',
title: '`<html>` element has a `[lang]` attribute',
failureTitle: '`<html>` element does not have a `[lang]` attribute',
description: 'If a page doesn\'t specify a lang attribute, a screen reader assumes ' +
'that the page is in the default language that the user chose when setting up the ' +
'screen reader. If the page isn\'t actually in the default language, then the screen ' +
'reader might not announce the page\'s text correctly. ' +
Expand Down