Skip to content

Commit 816c5e3

Browse files
author
Ben Gibson
committed
core(a11y): adjust weights and document a consistent approach to determining weights
1 parent a7223d7 commit 816c5e3

File tree

9 files changed

+247
-319
lines changed

9 files changed

+247
-319
lines changed

core/audits/accessibility/aria-allowed-role.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class ARIAAllowedRole extends AxeAudit {
3535
title: str_(UIStrings.title),
3636
failureTitle: str_(UIStrings.failureTitle),
3737
description: str_(UIStrings.description),
38+
scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE,
3839
requiredArtifacts: ['Accessibility'],
3940
};
4041
}

core/audits/accessibility/image-redundant-alt.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ImageRedundantAlt extends AxeAudit {
3636
title: str_(UIStrings.title),
3737
failureTitle: str_(UIStrings.failureTitle),
3838
description: str_(UIStrings.description),
39+
scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE,
3940
requiredArtifacts: ['Accessibility'],
4041
};
4142
}

core/audits/accessibility/landmark-one-main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class LandmarkOneMain extends AxeAudit {
3434
title: str_(UIStrings.title),
3535
failureTitle: str_(UIStrings.failureTitle),
3636
description: str_(UIStrings.description),
37-
scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE,
3837
requiredArtifacts: ['Accessibility'],
3938
};
4039
}

core/audits/accessibility/table-duplicate-name.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class TableDuplicateName extends AxeAudit {
3535
title: str_(UIStrings.title),
3636
failureTitle: str_(UIStrings.failureTitle),
3737
description: str_(UIStrings.description),
38+
scoreDisplayMode: AxeAudit.SCORING_MODES.INFORMATIVE,
3839
requiredArtifacts: ['Accessibility'],
3940
};
4041
}

core/config/default-config.js

Lines changed: 90 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -496,68 +496,86 @@ const defaultConfig = {
496496
description: str_(UIStrings.a11yCategoryDescription),
497497
manualDescription: str_(UIStrings.a11yCategoryManualDescription),
498498
supportedModes: ['navigation', 'snapshot'],
499-
// Audit weights are meant to match the aXe scoring system of
500-
// minor, moderate, serious, and critical.
501-
// See the audits listed at dequeuniversity.com/rules/axe/4.7.
502-
// Click on an audit and check the right hand column to see its severity.
499+
// Audit weights weights are derived from the axe-core "Impact",
500+
// with adjustments based on axe-core "Tags":
501+
//
502+
// ┌────────────┬───────────────────────────────────────────────┐
503+
// │ Impact │ Weight Based on Tags │
504+
// │ ├──────────────┬─────────────────┬──────────────┤
505+
// │ │ wcag A+AA │ best-practice │ experimental │
506+
// │ │ (ex: wcag2aa)│ (w/o wcag tag) │ │
507+
// ├────────────┼──────────────┼─────────────────┼──────────────┤
508+
// │ Minor │ 1 │ 0 │ 0 │
509+
// │ Moderate │ 3 │ 3 │ 0 │
510+
// │ Serious │ 7 │ 7 │ 0 │
511+
// │ Critical │ 10 │ 10 │ 0 │
512+
// └────────────┴──────────────┴─────────────────┴──────────────┘
513+
//
514+
// Notes:
515+
// • Experimental rules always have weight 0
516+
// • Best practice rules only affect scores when tagged with wcagA+AA
517+
// and are moderate, serious, or critical.
518+
//
519+
// To find the latest axe-core Impact and Tag values:
520+
// 1. Browse to https://dequeuniversity.com/rules/axe/html.
521+
// 2. Click on the latest rule set (ex: https://dequeuniversity.com/rules/axe/html/4.10)
522+
// 3. Review the tables
503523
auditRefs: [
504-
{id: 'accesskeys', weight: 7, group: 'a11y-navigation'},
505-
{id: 'aria-allowed-attr', weight: 10, group: 'a11y-aria'},
506-
{id: 'aria-allowed-role', weight: 1, group: 'a11y-aria'},
507-
{id: 'aria-command-name', weight: 7, group: 'a11y-aria'},
508-
{id: 'aria-conditional-attr', weight: 7, group: 'a11y-aria'},
509-
{id: 'aria-deprecated-role', weight: 1, group: 'a11y-aria'},
510-
{id: 'aria-dialog-name', weight: 7, group: 'a11y-aria'},
511-
{id: 'aria-hidden-body', weight: 10, group: 'a11y-aria'},
512-
{id: 'aria-hidden-focus', weight: 7, group: 'a11y-aria'},
513-
{id: 'aria-input-field-name', weight: 7, group: 'a11y-aria'},
514-
{id: 'aria-meter-name', weight: 7, group: 'a11y-aria'},
515-
{id: 'aria-progressbar-name', weight: 7, group: 'a11y-aria'},
516-
{id: 'aria-prohibited-attr', weight: 7, group: 'a11y-aria'},
517-
{id: 'aria-required-attr', weight: 10, group: 'a11y-aria'},
518-
{id: 'aria-required-children', weight: 10, group: 'a11y-aria'},
519-
{id: 'aria-required-parent', weight: 10, group: 'a11y-aria'},
520-
{id: 'aria-roles', weight: 7, group: 'a11y-aria'},
521-
{id: 'aria-text', weight: 7, group: 'a11y-aria'},
522-
{id: 'aria-toggle-field-name', weight: 7, group: 'a11y-aria'},
523-
{id: 'aria-tooltip-name', weight: 7, group: 'a11y-aria'},
524-
{id: 'aria-treeitem-name', weight: 7, group: 'a11y-aria'},
525-
{id: 'aria-valid-attr-value', weight: 10, group: 'a11y-aria'},
526-
{id: 'aria-valid-attr', weight: 10, group: 'a11y-aria'},
527-
{id: 'button-name', weight: 10, group: 'a11y-names-labels'},
528-
{id: 'bypass', weight: 7, group: 'a11y-navigation'},
529-
{id: 'color-contrast', weight: 7, group: 'a11y-color-contrast'},
530-
{id: 'definition-list', weight: 7, group: 'a11y-tables-lists'},
531-
{id: 'dlitem', weight: 7, group: 'a11y-tables-lists'},
532-
{id: 'document-title', weight: 7, group: 'a11y-names-labels'},
533-
{id: 'duplicate-id-aria', weight: 10, group: 'a11y-aria'},
534-
{id: 'form-field-multiple-labels', weight: 3, group: 'a11y-names-labels'},
535-
{id: 'frame-title', weight: 7, group: 'a11y-names-labels'},
536-
{id: 'heading-order', weight: 3, group: 'a11y-navigation'},
537-
{id: 'html-has-lang', weight: 7, group: 'a11y-language'},
538-
{id: 'html-lang-valid', weight: 7, group: 'a11y-language'},
539-
{id: 'html-xml-lang-mismatch', weight: 3, group: 'a11y-language'},
540-
{id: 'image-alt', weight: 10, group: 'a11y-names-labels'},
541-
{id: 'image-redundant-alt', weight: 1, group: 'a11y-names-labels'},
542-
{id: 'input-button-name', weight: 10, group: 'a11y-names-labels'},
543-
{id: 'input-image-alt', weight: 10, group: 'a11y-names-labels'},
544-
{id: 'label', weight: 7, group: 'a11y-names-labels'},
545-
{id: 'link-in-text-block', weight: 7, group: 'a11y-color-contrast'},
546-
{id: 'link-name', weight: 7, group: 'a11y-names-labels'},
547-
{id: 'list', weight: 7, group: 'a11y-tables-lists'},
548-
{id: 'listitem', weight: 7, group: 'a11y-tables-lists'},
549-
{id: 'meta-refresh', weight: 10, group: 'a11y-best-practices'},
550-
{id: 'meta-viewport', weight: 10, group: 'a11y-best-practices'},
551-
{id: 'object-alt', weight: 7, group: 'a11y-names-labels'},
552-
{id: 'select-name', weight: 7, group: 'a11y-names-labels'},
553-
{id: 'skip-link', weight: 3, group: 'a11y-names-labels'},
554-
{id: 'tabindex', weight: 7, group: 'a11y-navigation'},
555-
{id: 'table-duplicate-name', weight: 1, group: 'a11y-tables-lists'},
556-
{id: 'target-size', weight: 7, group: 'a11y-best-practices'},
557-
{id: 'td-headers-attr', weight: 7, group: 'a11y-tables-lists'},
558-
{id: 'th-has-data-cells', weight: 7, group: 'a11y-tables-lists'},
559-
{id: 'valid-lang', weight: 7, group: 'a11y-language'},
560-
{id: 'video-caption', weight: 10, group: 'a11y-audio-video'},
524+
{id: 'accesskeys', weight: 7, group: 'a11y-navigation'}, // Serious, best-practice
525+
{id: 'aria-allowed-attr', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
526+
{id: 'aria-command-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
527+
{id: 'aria-conditional-attr', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
528+
{id: 'aria-deprecated-role', weight: 1, group: 'a11y-aria'}, // Minor, wcag2a
529+
{id: 'aria-dialog-name', weight: 7, group: 'a11y-aria'}, // Serious, best-practice
530+
{id: 'aria-hidden-body', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
531+
{id: 'aria-hidden-focus', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
532+
{id: 'aria-input-field-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
533+
{id: 'aria-meter-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
534+
{id: 'aria-progressbar-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
535+
{id: 'aria-prohibited-attr', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
536+
{id: 'aria-required-attr', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
537+
{id: 'aria-required-children', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
538+
{id: 'aria-required-parent', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
539+
{id: 'aria-roles', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
540+
{id: 'aria-text', weight: 7, group: 'a11y-aria'}, // Serious, best-practice
541+
{id: 'aria-toggle-field-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
542+
{id: 'aria-tooltip-name', weight: 7, group: 'a11y-aria'}, // Serious, wcag2a
543+
{id: 'aria-treeitem-name', weight: 7, group: 'a11y-aria'}, // Serious, best-practice
544+
{id: 'aria-valid-attr-value', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
545+
{id: 'aria-valid-attr', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
546+
{id: 'button-name', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
547+
{id: 'bypass', weight: 7, group: 'a11y-navigation'}, // Serious, wcag2a
548+
{id: 'color-contrast', weight: 7, group: 'a11y-color-contrast'}, // Serious, wcag2aa
549+
{id: 'definition-list', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
550+
{id: 'dlitem', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
551+
{id: 'document-title', weight: 7, group: 'a11y-names-labels'}, // Serious, wcag2a
552+
{id: 'duplicate-id-aria', weight: 10, group: 'a11y-aria'}, // Critical, wcag2a
553+
{id: 'form-field-multiple-labels', weight: 3, group: 'a11y-names-labels'}, // Moderate, wcag2a
554+
{id: 'frame-title', weight: 7, group: 'a11y-names-labels'}, // Serious, wcag2a
555+
{id: 'heading-order', weight: 3, group: 'a11y-navigation'}, // Moderate, best-practice
556+
{id: 'html-has-lang', weight: 7, group: 'a11y-language'}, // Serious, wcag2a
557+
{id: 'html-lang-valid', weight: 7, group: 'a11y-language'}, // Serious, wcag2a
558+
{id: 'html-xml-lang-mismatch', weight: 3, group: 'a11y-language'}, // Moderate, wcag2a
559+
{id: 'image-alt', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
560+
{id: 'input-button-name', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
561+
{id: 'input-image-alt', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
562+
{id: 'label', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
563+
{id: 'link-in-text-block', weight: 7, group: 'a11y-color-contrast'}, // Serious, wcag2a
564+
{id: 'link-name', weight: 7, group: 'a11y-names-labels'}, // Serious, wcag2a
565+
{id: 'list', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
566+
{id: 'listitem', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
567+
{id: 'meta-refresh', weight: 10, group: 'a11y-best-practices'}, // Critical, wcag2a
568+
{id: 'meta-viewport', weight: 10, group: 'a11y-best-practices'}, // Critical, wcag2aa
569+
{id: 'object-alt', weight: 7, group: 'a11y-names-labels'}, // Serious, wcag2a
570+
{id: 'select-name', weight: 10, group: 'a11y-names-labels'}, // Critical, wcag2a
571+
{id: 'skip-link', weight: 3, group: 'a11y-names-labels'}, // Moderate, best-practice
572+
{id: 'tabindex', weight: 7, group: 'a11y-navigation'}, // Serious, best-practice
573+
{id: 'target-size', weight: 7, group: 'a11y-best-practices'}, // Serious, wcag22aa
574+
{id: 'td-headers-attr', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
575+
{id: 'th-has-data-cells', weight: 7, group: 'a11y-tables-lists'}, // Serious, wcag2a
576+
{id: 'valid-lang', weight: 7, group: 'a11y-language'}, // Serious, wcag2aa
577+
{id: 'video-caption', weight: 10, group: 'a11y-audio-video'}, // Critical, wcag2a
578+
{id: 'landmark-one-main', weight: 3, group: 'a11y-best-practices'}, // Moderate, best-practice
561579
// Manual audits
562580
{id: 'focusable-controls', weight: 0},
563581
{id: 'interactive-element-affordance', weight: 0},
@@ -569,13 +587,17 @@ const defaultConfig = {
569587
{id: 'offscreen-content-hidden', weight: 0},
570588
{id: 'custom-controls-labels', weight: 0},
571589
{id: 'custom-controls-roles', weight: 0},
572-
// Hidden audits
573-
{id: 'empty-heading', weight: 0, group: 'hidden'},
574-
{id: 'identical-links-same-purpose', weight: 0, group: 'hidden'},
575-
{id: 'landmark-one-main', weight: 0, group: 'hidden'},
576-
{id: 'label-content-name-mismatch', weight: 0, group: 'hidden'},
577-
{id: 'table-fake-caption', weight: 0, group: 'hidden'},
578-
{id: 'td-has-header', weight: 0, group: 'hidden'},
590+
// Low-impact best-practices
591+
{id: 'table-duplicate-name', weight: 0, group: 'a11y-best-practices'}, // Minor, best-practice
592+
{id: 'empty-heading', weight: 0, group: 'a11y-best-practices'}, // Minor, best-practice
593+
{id: 'aria-allowed-role', weight: 0, group: 'a11y-best-practices'}, // Minor, best-practice
594+
{id: 'image-redundant-alt', weight: 0, group: 'a11y-names-labels'}, // Minor, best-practice
595+
// WCAG AAA
596+
{id: 'identical-links-same-purpose', weight: 0, group: 'a11y-best-practices'}, // Minor, wcag2aaa
597+
// Hidden audits (ie. experimental)
598+
{id: 'label-content-name-mismatch', weight: 0, group: 'hidden'}, // Serious, experimental
599+
{id: 'table-fake-caption', weight: 0, group: 'hidden'}, // Serious, experimental
600+
{id: 'td-has-header', weight: 0, group: 'hidden'}, // Critical, experimental
579601
],
580602
},
581603
'best-practices': {

core/scoring.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ReportScoring {
5757
const member = {...configMember};
5858

5959
// If a result was not applicable, meaning its checks did not run against anything on
60-
// the page, force it's weight to 0. It will not count during the arithmeticMean() but
60+
// the page, force its weight to 0. It will not count during the arithmeticMean() but
6161
// will still be included in the final report json and displayed in the report as
6262
// "Not Applicable".
6363
const result = resultsByAuditId[member.id];

0 commit comments

Comments
 (0)