Skip to content

Commit

Permalink
core(a11y): update scoring weights based on severity (#8823)
Browse files Browse the repository at this point in the history
  • Loading branch information
robdodson authored and brendankenny committed May 3, 2019
1 parent a91a53d commit 31df230
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 85 deletions.
64 changes: 32 additions & 32 deletions lighthouse-cli/test/cli/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -387,42 +387,42 @@ Object {
Object {
"group": "a11y-aria",
"id": "aria-allowed-attr",
"weight": 3,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-required-attr",
"weight": 2,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-required-children",
"weight": 5,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-required-parent",
"weight": 2,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-roles",
"weight": 3,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-valid-attr-value",
"weight": 2,
"weight": 10,
},
Object {
"group": "a11y-aria",
"id": "aria-valid-attr",
"weight": 5,
"weight": 10,
},
Object {
"group": "a11y-audio-video",
"id": "audio-caption",
"weight": 4,
"weight": 10,
},
Object {
"group": "a11y-names-labels",
Expand All @@ -432,57 +432,57 @@ Object {
Object {
"group": "a11y-navigation",
"id": "bypass",
"weight": 10,
"weight": 3,
},
Object {
"group": "a11y-color-contrast",
"id": "color-contrast",
"weight": 6,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "definition-list",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "dlitem",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-names-labels",
"id": "document-title",
"weight": 2,
"weight": 3,
},
Object {
"group": "a11y-best-practices",
"id": "duplicate-id",
"weight": 5,
"weight": 1,
},
Object {
"group": "a11y-names-labels",
"id": "frame-title",
"weight": 5,
"weight": 3,
},
Object {
"group": "a11y-language",
"id": "html-has-lang",
"weight": 4,
"weight": 3,
},
Object {
"group": "a11y-language",
"id": "html-lang-valid",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-names-labels",
"id": "image-alt",
"weight": 8,
"weight": 10,
},
Object {
"group": "a11y-names-labels",
"id": "input-image-alt",
"weight": 1,
"weight": 10,
},
Object {
"group": "a11y-names-labels",
Expand All @@ -492,67 +492,67 @@ Object {
Object {
"group": "a11y-tables-lists",
"id": "layout-table",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-names-labels",
"id": "link-name",
"weight": 9,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "list",
"weight": 5,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "listitem",
"weight": 4,
"weight": 3,
},
Object {
"group": "a11y-best-practices",
"id": "meta-refresh",
"weight": 1,
"weight": 10,
},
Object {
"group": "a11y-best-practices",
"id": "meta-viewport",
"weight": 3,
"weight": 10,
},
Object {
"group": "a11y-names-labels",
"id": "object-alt",
"weight": 4,
"weight": 3,
},
Object {
"group": "a11y-navigation",
"id": "tabindex",
"weight": 4,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "td-headers-attr",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-tables-lists",
"id": "th-has-data-cells",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-language",
"id": "valid-lang",
"weight": 1,
"weight": 3,
},
Object {
"group": "a11y-audio-video",
"id": "video-caption",
"weight": 4,
"weight": 10,
},
Object {
"group": "a11y-audio-video",
"id": "video-description",
"weight": 3,
"weight": 10,
},
Object {
"id": "logical-tab-order",
Expand Down
68 changes: 36 additions & 32 deletions lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,42 +395,46 @@ const defaultConfig = {
title: str_(UIStrings.a11yCategoryTitle),
description: str_(UIStrings.a11yCategoryDescription),
manualDescription: str_(UIStrings.a11yCategoryManualDescription),
// Audit weights are meant to match the aXe scoring system of
// minor, serious, and critical.
// See the audits listed at dequeuniversity.com/rules/axe/3.2.
// Click on an audit and check the right hand column to see its severity.
auditRefs: [
{id: 'accesskeys', weight: 3, group: 'a11y-navigation'},
{id: 'aria-allowed-attr', weight: 3, group: 'a11y-aria'},
{id: 'aria-required-attr', weight: 2, group: 'a11y-aria'},
{id: 'aria-required-children', weight: 5, group: 'a11y-aria'},
{id: 'aria-required-parent', weight: 2, group: 'a11y-aria'},
{id: 'aria-roles', weight: 3, group: 'a11y-aria'},
{id: 'aria-valid-attr-value', weight: 2, group: 'a11y-aria'},
{id: 'aria-valid-attr', weight: 5, group: 'a11y-aria'},
{id: 'audio-caption', weight: 4, group: 'a11y-audio-video'},
{id: 'aria-allowed-attr', weight: 10, group: 'a11y-aria'},
{id: 'aria-required-attr', weight: 10, group: 'a11y-aria'},
{id: 'aria-required-children', weight: 10, group: 'a11y-aria'},
{id: 'aria-required-parent', weight: 10, group: 'a11y-aria'},
{id: 'aria-roles', weight: 10, group: 'a11y-aria'},
{id: 'aria-valid-attr-value', weight: 10, group: 'a11y-aria'},
{id: 'aria-valid-attr', weight: 10, group: 'a11y-aria'},
{id: 'audio-caption', weight: 10, group: 'a11y-audio-video'},
{id: 'button-name', weight: 10, group: 'a11y-names-labels'},
{id: 'bypass', weight: 10, group: 'a11y-navigation'},
{id: 'color-contrast', weight: 6, group: 'a11y-color-contrast'},
{id: 'definition-list', weight: 1, group: 'a11y-tables-lists'},
{id: 'dlitem', weight: 1, group: 'a11y-tables-lists'},
{id: 'document-title', weight: 2, group: 'a11y-names-labels'},
{id: 'duplicate-id', weight: 5, group: 'a11y-best-practices'},
{id: 'frame-title', weight: 5, group: 'a11y-names-labels'},
{id: 'html-has-lang', weight: 4, group: 'a11y-language'},
{id: 'html-lang-valid', weight: 1, group: 'a11y-language'},
{id: 'image-alt', weight: 8, group: 'a11y-names-labels'},
{id: 'input-image-alt', weight: 1, group: 'a11y-names-labels'},
{id: 'bypass', weight: 3, group: 'a11y-navigation'},
{id: 'color-contrast', weight: 3, group: 'a11y-color-contrast'},
{id: 'definition-list', weight: 3, group: 'a11y-tables-lists'},
{id: 'dlitem', weight: 3, group: 'a11y-tables-lists'},
{id: 'document-title', weight: 3, group: 'a11y-names-labels'},
{id: 'duplicate-id', weight: 1, group: 'a11y-best-practices'},
{id: 'frame-title', weight: 3, group: 'a11y-names-labels'},
{id: 'html-has-lang', weight: 3, group: 'a11y-language'},
{id: 'html-lang-valid', weight: 3, group: 'a11y-language'},
{id: 'image-alt', weight: 10, group: 'a11y-names-labels'},
{id: 'input-image-alt', weight: 10, group: 'a11y-names-labels'},
{id: 'label', weight: 10, group: 'a11y-names-labels'},
{id: 'layout-table', weight: 1, group: 'a11y-tables-lists'},
{id: 'link-name', weight: 9, group: 'a11y-names-labels'},
{id: 'list', weight: 5, group: 'a11y-tables-lists'},
{id: 'listitem', weight: 4, group: 'a11y-tables-lists'},
{id: 'meta-refresh', weight: 1, group: 'a11y-best-practices'},
{id: 'meta-viewport', weight: 3, group: 'a11y-best-practices'},
{id: 'object-alt', weight: 4, group: 'a11y-names-labels'},
{id: 'tabindex', weight: 4, group: 'a11y-navigation'},
{id: 'td-headers-attr', weight: 1, group: 'a11y-tables-lists'},
{id: 'th-has-data-cells', weight: 1, group: 'a11y-tables-lists'},
{id: 'valid-lang', weight: 1, group: 'a11y-language'},
{id: 'video-caption', weight: 4, group: 'a11y-audio-video'},
{id: 'video-description', weight: 3, group: 'a11y-audio-video'},
{id: 'layout-table', weight: 3, group: 'a11y-tables-lists'},
{id: 'link-name', weight: 3, group: 'a11y-names-labels'},
{id: 'list', weight: 3, group: 'a11y-tables-lists'},
{id: 'listitem', weight: 3, group: 'a11y-tables-lists'},
{id: 'meta-refresh', weight: 10, group: 'a11y-best-practices'},
{id: 'meta-viewport', weight: 10, group: 'a11y-best-practices'},
{id: 'object-alt', weight: 3, group: 'a11y-names-labels'},
{id: 'tabindex', weight: 3, group: 'a11y-navigation'},
{id: 'td-headers-attr', weight: 3, group: 'a11y-tables-lists'},
{id: 'th-has-data-cells', weight: 3, group: 'a11y-tables-lists'},
{id: 'valid-lang', weight: 3, group: 'a11y-language'},
{id: 'video-caption', weight: 10, group: 'a11y-audio-video'},
{id: 'video-description', weight: 10, group: 'a11y-audio-video'},
// Manual audits
{id: 'logical-tab-order', weight: 0},
{id: 'focusable-controls', weight: 0},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('CategoryRenderer', () => {
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);

const gauge = categoryDOM.querySelector('.lh-gauge__percentage');
assert.equal(gauge.textContent.trim(), '36', 'score is 0-100');
assert.equal(gauge.textContent.trim(), '38', 'score is 0-100');

const score = categoryDOM.querySelector('.lh-category-header');
const value = categoryDOM.querySelector('.lh-gauge__percentage');
Expand Down
20 changes: 10 additions & 10 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3298,12 +3298,12 @@
},
{
"id": "bypass",
"weight": 10,
"weight": 3,
"group": "a11y-navigation"
},
{
"id": "color-contrast",
"weight": 6,
"weight": 3,
"group": "a11y-color-contrast"
},
{
Expand All @@ -3318,12 +3318,12 @@
},
{
"id": "document-title",
"weight": 2,
"weight": 3,
"group": "a11y-names-labels"
},
{
"id": "duplicate-id",
"weight": 5,
"weight": 1,
"group": "a11y-best-practices"
},
{
Expand All @@ -3333,7 +3333,7 @@
},
{
"id": "html-has-lang",
"weight": 4,
"weight": 3,
"group": "a11y-language"
},
{
Expand All @@ -3343,7 +3343,7 @@
},
{
"id": "image-alt",
"weight": 8,
"weight": 10,
"group": "a11y-names-labels"
},
{
Expand All @@ -3363,7 +3363,7 @@
},
{
"id": "link-name",
"weight": 9,
"weight": 3,
"group": "a11y-names-labels"
},
{
Expand All @@ -3383,12 +3383,12 @@
},
{
"id": "meta-viewport",
"weight": 3,
"weight": 10,
"group": "a11y-best-practices"
},
{
"id": "object-alt",
"weight": 4,
"weight": 3,
"group": "a11y-names-labels"
},
{
Expand Down Expand Up @@ -3467,7 +3467,7 @@
}
],
"id": "accessibility",
"score": 0.36
"score": 0.38
},
"best-practices": {
"title": "Best Practices",
Expand Down
Loading

0 comments on commit 31df230

Please sign in to comment.