axe-core 4.4.1-canary.fa6cbf4 → 4.4.2-canary.2674841

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/axe.d.ts CHANGED
@@ -249,6 +249,7 @@ declare namespace axe {
249
249
  help: string;
250
250
  helpUrl: string;
251
251
  tags: string[];
252
+ actIds?: string[];
252
253
  }
253
254
  interface SerialDqElement {
254
255
  source: string;
package/axe.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! axe v4.4.1-canary.fa6cbf4
1
+ /*! axe v4.4.2-canary.2674841
2
2
  * Copyright (c) 2022 Deque Systems, Inc.
3
3
  *
4
4
  * Your use of this Source Code Form is subject to the terms of the Mozilla Public
@@ -22,7 +22,7 @@
22
22
  }, _typeof(obj);
23
23
  }
24
24
  var axe = axe || {};
25
- axe.version = '4.4.1-canary.fa6cbf4';
25
+ axe.version = '4.4.2-canary.2674841';
26
26
  if (typeof define === 'function' && define.amd) {
27
27
  define('axe-core', [], function() {
28
28
  return axe;
@@ -7960,9 +7960,13 @@
7960
7960
  return false;
7961
7961
  }
7962
7962
  var is_hidden_with_css_default = isHiddenWithCSS;
7963
+ var allowedDisabledNodeNames = [ 'button', 'command', 'fieldset', 'keygen', 'optgroup', 'option', 'select', 'textarea', 'input' ];
7964
+ function isDisabledAttrAllowed(nodeName2) {
7965
+ return allowedDisabledNodeNames.includes(nodeName2);
7966
+ }
7963
7967
  function focusDisabled(el) {
7964
7968
  var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el);
7965
- if (vNode.hasAttr('disabled')) {
7969
+ if (isDisabledAttrAllowed(vNode.props.nodeName) && vNode.hasAttr('disabled')) {
7966
7970
  return true;
7967
7971
  }
7968
7972
  var parentNode = vNode.parent;
@@ -9247,7 +9251,7 @@
9247
9251
  contentTypes: [ 'phrasing', 'flow' ],
9248
9252
  allowedRoles: true
9249
9253
  },
9250
- addres: {
9254
+ address: {
9251
9255
  contentTypes: [ 'flow' ],
9252
9256
  allowedRoles: true
9253
9257
  },
@@ -9693,7 +9697,7 @@
9693
9697
  },
9694
9698
  nav: {
9695
9699
  contentTypes: [ 'sectioning', 'flow' ],
9696
- allowedRoles: [ 'doc-index', 'doc-pagelist', 'doc-toc', 'menu', 'menubar', 'tablist' ],
9700
+ allowedRoles: [ 'doc-index', 'doc-pagelist', 'doc-toc', 'menu', 'menubar', 'none', 'presentation', 'tablist' ],
9697
9701
  shadowRoot: true
9698
9702
  },
9699
9703
  noscript: {
@@ -10597,6 +10601,7 @@
10597
10601
  return VirtualNode;
10598
10602
  }(abstract_virtual_node_default);
10599
10603
  var virtual_node_default = VirtualNode;
10604
+ var hasShadowRoot;
10600
10605
  function getSlotChildren(node) {
10601
10606
  var retVal = [];
10602
10607
  node = node.firstChild;
@@ -10620,6 +10625,7 @@
10620
10625
  }
10621
10626
  nodeName2 = node.nodeName.toLowerCase();
10622
10627
  if (is_shadow_root_default(node)) {
10628
+ hasShadowRoot = true;
10623
10629
  retVal = new virtual_node_default(node, parent, shadowId);
10624
10630
  shadowId = 'a' + Math.random().toString().substring(2);
10625
10631
  realArray = Array.from(node.shadowRoot.childNodes);
@@ -10668,8 +10674,11 @@
10668
10674
  function getFlattenedTree() {
10669
10675
  var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement;
10670
10676
  var shadowId = arguments.length > 1 ? arguments[1] : undefined;
10677
+ hasShadowRoot = false;
10671
10678
  cache_default.set('nodeMap', new WeakMap());
10672
- return flattenTree(node, shadowId, null);
10679
+ var tree = flattenTree(node, shadowId, null);
10680
+ tree[0]._hasShadowRoot = hasShadowRoot;
10681
+ return tree;
10673
10682
  }
10674
10683
  var get_flattened_tree_default = getFlattenedTree;
10675
10684
  function getBaseLang(lang) {
@@ -16334,14 +16343,14 @@
16334
16343
  'aria-describedby': function ariaDescribedby(validValue) {
16335
16344
  if (!validValue) {
16336
16345
  needsReview = 'aria-describedby="'.concat(virtualNode.attr('aria-describedby'), '"');
16337
- messageKey = 'noId';
16346
+ messageKey = axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId';
16338
16347
  }
16339
16348
  return;
16340
16349
  },
16341
16350
  'aria-labelledby': function ariaLabelledby(validValue) {
16342
16351
  if (!validValue) {
16343
16352
  needsReview = 'aria-labelledby="'.concat(virtualNode.attr('aria-labelledby'), '"');
16344
- messageKey = 'noId';
16353
+ messageKey = axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId';
16345
16354
  }
16346
16355
  }
16347
16356
  };
@@ -16460,7 +16469,15 @@
16460
16469
  }
16461
16470
  var no_implicit_explicit_label_evaluate_default = noImplicitExplicitLabelEvaluate;
16462
16471
  function unsupportedroleEvaluate(node, options, virtualNode) {
16463
- return is_unsupported_role_default(get_role_default(virtualNode));
16472
+ var role = get_role_default(virtualNode, {
16473
+ dpub: true,
16474
+ fallback: true
16475
+ });
16476
+ var isUnsupported = is_unsupported_role_default(role);
16477
+ if (isUnsupported) {
16478
+ this.data(role);
16479
+ }
16480
+ return isUnsupported;
16464
16481
  }
16465
16482
  var unsupportedrole_evaluate_default = unsupportedroleEvaluate;
16466
16483
  var VALID_TAG_NAMES_FOR_SCROLLABLE_REGIONS = {
@@ -16989,6 +17006,9 @@
16989
17006
  function colorContrastEvaluate(node, options, virtualNode) {
16990
17007
  var ignoreUnicode = options.ignoreUnicode, ignoreLength = options.ignoreLength, ignorePseudo = options.ignorePseudo, boldValue = options.boldValue, boldTextPt = options.boldTextPt, largeTextPt = options.largeTextPt, contrastRatio = options.contrastRatio, shadowOutlineEmMax = options.shadowOutlineEmMax, pseudoSizeThreshold = options.pseudoSizeThreshold;
16991
17008
  if (!is_visible_default(node, false)) {
17009
+ this.data({
17010
+ messageKey: 'hidden'
17011
+ });
16992
17012
  return true;
16993
17013
  }
16994
17014
  var visibleText = visible_virtual_default(virtualNode, false, true);
@@ -16998,13 +17018,23 @@
16998
17018
  });
16999
17019
  return void 0;
17000
17020
  }
17021
+ var nodeStyle = window.getComputedStyle(node);
17022
+ var fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
17023
+ var fontWeight = nodeStyle.getPropertyValue('font-weight');
17024
+ var bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold';
17025
+ var ptSize = Math.ceil(fontSize * 72) / 96;
17026
+ var isSmallFont = bold && ptSize < boldTextPt || !bold && ptSize < largeTextPt;
17027
+ var _ref58 = isSmallFont ? contrastRatio.normal : contrastRatio.large, expected = _ref58.expected, minThreshold = _ref58.minThreshold, maxThreshold = _ref58.maxThreshold;
17001
17028
  var pseudoElm = findPseudoElement(virtualNode, {
17002
17029
  ignorePseudo: ignorePseudo,
17003
17030
  pseudoSizeThreshold: pseudoSizeThreshold
17004
17031
  });
17005
17032
  if (pseudoElm) {
17006
17033
  this.data({
17007
- messageKey: 'pseudoContent'
17034
+ fontSize: ''.concat((fontSize * 72 / 96).toFixed(1), 'pt (').concat(fontSize, 'px)'),
17035
+ fontWeight: bold ? 'bold' : 'normal',
17036
+ messageKey: 'pseudoContent',
17037
+ expectedContrastRatio: expected + ':1'
17008
17038
  });
17009
17039
  this.relatedNodes(pseudoElm.actualNode);
17010
17040
  return void 0;
@@ -17016,10 +17046,6 @@
17016
17046
  minRatio: .001,
17017
17047
  maxRatio: shadowOutlineEmMax
17018
17048
  });
17019
- var nodeStyle = window.getComputedStyle(node);
17020
- var fontSize = parseFloat(nodeStyle.getPropertyValue('font-size'));
17021
- var fontWeight = nodeStyle.getPropertyValue('font-weight');
17022
- var bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold';
17023
17049
  var contrast = null;
17024
17050
  var contrastContributor = null;
17025
17051
  var shadowColor = null;
@@ -17035,11 +17061,11 @@
17035
17061
  contrastContributor = bgShContrast > fgShContrast ? 'shadowOnBgColor' : 'fgOnShadowColor';
17036
17062
  }
17037
17063
  }
17038
- var ptSize = Math.ceil(fontSize * 72) / 96;
17039
- var isSmallFont = bold && ptSize < boldTextPt || !bold && ptSize < largeTextPt;
17040
- var _ref58 = isSmallFont ? contrastRatio.normal : contrastRatio.large, expected = _ref58.expected, minThreshold = _ref58.minThreshold, maxThreshold = _ref58.maxThreshold;
17041
17064
  var isValid = contrast > expected;
17042
17065
  if (typeof minThreshold === 'number' && contrast < minThreshold || typeof maxThreshold === 'number' && contrast > maxThreshold) {
17066
+ this.data({
17067
+ contrastRatio: contrast
17068
+ });
17043
17069
  return true;
17044
17070
  }
17045
17071
  var truncatedResult = Math.floor(contrast * 100) / 100;
@@ -17395,10 +17421,12 @@
17395
17421
  return out;
17396
17422
  }, []);
17397
17423
  this.relatedNodes(relatedNodes);
17398
- if (relatedNodes.length && is_modal_open_default()) {
17424
+ if (relatedNodes.length === 0 || is_modal_open_default()) {
17399
17425
  return true;
17400
17426
  }
17401
- return relatedNodes.length === 0;
17427
+ return relatedNodes.every(function(related) {
17428
+ return related.onfocus;
17429
+ }) ? void 0 : false;
17402
17430
  }
17403
17431
  var focusable_disabled_evaluate_default = focusableDisabledEvaluate;
17404
17432
  function focusableElementEvaluate(node, options, virtualNode) {
@@ -17468,10 +17496,12 @@
17468
17496
  return out;
17469
17497
  }, []);
17470
17498
  this.relatedNodes(relatedNodes);
17471
- if (relatedNodes.length > 0 && is_modal_open_default()) {
17499
+ if (relatedNodes.length === 0 || is_modal_open_default()) {
17472
17500
  return true;
17473
17501
  }
17474
- return relatedNodes.length === 0;
17502
+ return relatedNodes.every(function(related) {
17503
+ return related.onfocus;
17504
+ }) ? void 0 : false;
17475
17505
  }
17476
17506
  var focusable_not_tabbable_evaluate_default = focusableNotTabbableEvaluate;
17477
17507
  function focusableDescendants(vNode) {
@@ -20130,6 +20160,7 @@
20130
20160
  this.none = spec.none || [];
20131
20161
  this.tags = spec.tags || [];
20132
20162
  this.preload = spec.preload ? true : false;
20163
+ this.actIds = spec.actIds;
20133
20164
  if (spec.matches) {
20134
20165
  this.matches = createExecutionContext(spec.matches);
20135
20166
  }
@@ -20462,6 +20493,9 @@
20462
20493
  if (spec.hasOwnProperty('tags')) {
20463
20494
  this.tags = spec.tags;
20464
20495
  }
20496
+ if (spec.hasOwnProperty('actIds')) {
20497
+ this.actIds = spec.actIds;
20498
+ }
20465
20499
  if (spec.hasOwnProperty('matches')) {
20466
20500
  this.matches = createExecutionContext(spec.matches);
20467
20501
  }
@@ -21198,7 +21232,8 @@
21198
21232
  description: rd.description,
21199
21233
  help: rd.help,
21200
21234
  helpUrl: rd.helpUrl,
21201
- tags: matchingRule.tags
21235
+ tags: matchingRule.tags,
21236
+ actIds: matchingRule.actIds
21202
21237
  };
21203
21238
  });
21204
21239
  }
@@ -21845,8 +21880,8 @@
21845
21880
  help: 'aria-hidden=\'true\' must not be present on the document body'
21846
21881
  },
21847
21882
  'aria-hidden-focus': {
21848
- description: 'Ensures aria-hidden elements do not contain focusable elements',
21849
- help: 'ARIA hidden element must not contain focusable elements'
21883
+ description: 'Ensures aria-hidden elements are not focusable nor contain focusable elements',
21884
+ help: 'ARIA hidden element must not be focusable or contain focusable elements'
21850
21885
  },
21851
21886
  'aria-input-field-name': {
21852
21887
  description: 'Ensures every ARIA input field has an accessible name',
@@ -21970,7 +22005,7 @@
21970
22005
  },
21971
22006
  'empty-table-header': {
21972
22007
  description: 'Ensures table headers have discernible text',
21973
- help: 'Table header text must not be empty'
22008
+ help: 'Table header text should not be empty'
21974
22009
  },
21975
22010
  'focus-order-semantics': {
21976
22011
  description: 'Ensures elements in the focus order have a role appropriate for interactive content',
@@ -22348,6 +22383,7 @@
22348
22383
  },
22349
22384
  incomplete: {
22350
22385
  noId: 'ARIA attribute element ID does not exist on the page: ${data.needsReview}',
22386
+ noIdShadow: 'ARIA attribute element ID does not exist on the page or is a descendant of a different shadow DOM tree: ${data.needsReview}',
22351
22387
  ariaCurrent: 'ARIA attribute value is invalid and will be treated as "aria-current=true": ${data.needsReview}',
22352
22388
  idrefs: 'Unable to determine if ARIA attribute element ID exists on the page: ${data.needsReview}'
22353
22389
  }
@@ -22367,7 +22403,7 @@
22367
22403
  impact: 'minor',
22368
22404
  messages: {
22369
22405
  pass: 'ARIA role is not deprecated',
22370
- fail: 'The role used is deprecated: ${data.values}'
22406
+ fail: 'The role used is deprecated: ${data}'
22371
22407
  }
22372
22408
  },
22373
22409
  fallbackrole: {
@@ -22423,7 +22459,7 @@
22423
22459
  impact: 'critical',
22424
22460
  messages: {
22425
22461
  pass: 'ARIA role is supported',
22426
- fail: 'The role used is not widely supported in screen readers and assistive technologies: ${data.values}'
22462
+ fail: 'The role used is not widely supported in screen readers and assistive technologies: ${data}'
22427
22463
  }
22428
22464
  },
22429
22465
  'valid-scrollable-semantics': {
@@ -22462,7 +22498,10 @@
22462
22498
  'color-contrast': {
22463
22499
  impact: 'serious',
22464
22500
  messages: {
22465
- pass: 'Element has sufficient color contrast of ${data.contrastRatio}',
22501
+ pass: {
22502
+ default: 'Element has sufficient color contrast of ${data.contrastRatio}',
22503
+ hidden: 'Element is hidden'
22504
+ },
22466
22505
  fail: {
22467
22506
  default: 'Element has insufficient color contrast of ${data.contrastRatio} (foreground color: ${data.fgColor}, background color: ${data.bgColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}',
22468
22507
  fgOnShadowColor: 'Element has insufficient color contrast of ${data.contrastRatio} between the foreground and shadow color (foreground color: ${data.fgColor}, text-shadow color: ${data.shadowColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}',
@@ -22532,6 +22571,7 @@
22532
22571
  impact: 'serious',
22533
22572
  messages: {
22534
22573
  pass: 'No focusable elements contained within element',
22574
+ incomplete: 'Check if the focusable elements immediately move the focus indicator',
22535
22575
  fail: 'Focusable content should be disabled or be removed from the DOM'
22536
22576
  }
22537
22577
  },
@@ -22561,6 +22601,7 @@
22561
22601
  impact: 'serious',
22562
22602
  messages: {
22563
22603
  pass: 'No focusable elements contained within element',
22604
+ incomplete: 'Check if the focusable elements immediately move the focus indicator',
22564
22605
  fail: 'Focusable content should have tabindex=\'-1\' or be removed from the DOM'
22565
22606
  }
22566
22607
  },
@@ -23169,7 +23210,7 @@
23169
23210
  id: 'area-alt',
23170
23211
  selector: 'map area[href]',
23171
23212
  excludeHidden: false,
23172
- tags: [ 'cat.text-alternatives', 'wcag2a', 'wcag111', 'wcag244', 'wcag412', 'section508', 'section508.22.a', 'ACT' ],
23213
+ tags: [ 'cat.text-alternatives', 'wcag2a', 'wcag244', 'wcag412', 'section508', 'section508.22.a', 'ACT' ],
23173
23214
  actIds: [ 'c487ae' ],
23174
23215
  all: [],
23175
23216
  any: [ {
@@ -23258,7 +23299,7 @@
23258
23299
  selector: '[aria-hidden="true"]',
23259
23300
  matches: 'aria-hidden-focus-matches',
23260
23301
  excludeHidden: false,
23261
- tags: [ 'cat.name-role-value', 'wcag2a', 'wcag412', 'wcag131' ],
23302
+ tags: [ 'cat.name-role-value', 'wcag2a', 'wcag412' ],
23262
23303
  actIds: [ '6cfa84' ],
23263
23304
  all: [ 'focusable-modal-open', 'focusable-disabled', 'focusable-not-tabbable' ],
23264
23305
  any: [],
@@ -23643,8 +23684,7 @@
23643
23684
  }, {
23644
23685
  id: 'empty-table-header',
23645
23686
  selector: 'th, [role="rowheader"], [role="columnheader"]',
23646
- tags: [ 'wcag131', 'cat.aria' ],
23647
- reviewOnFail: true,
23687
+ tags: [ 'cat.name-role-value', 'best-practice' ],
23648
23688
  all: [],
23649
23689
  any: [ 'has-visible-text' ],
23650
23690
  none: []
@@ -23822,7 +23862,7 @@
23822
23862
  id: 'input-image-alt',
23823
23863
  selector: 'input[type="image"]',
23824
23864
  matches: 'no-explicit-name-required-matches',
23825
- tags: [ 'cat.text-alternatives', 'wcag2a', 'wcag111', 'section508', 'section508.22.a', 'ACT' ],
23865
+ tags: [ 'cat.text-alternatives', 'wcag2a', 'wcag111', 'wcag412', 'section508', 'section508.22.a', 'ACT' ],
23826
23866
  actIds: [ '59796f' ],
23827
23867
  all: [],
23828
23868
  any: [ {
@@ -23863,7 +23903,7 @@
23863
23903
  id: 'label',
23864
23904
  selector: 'input, textarea',
23865
23905
  matches: 'label-matches',
23866
- tags: [ 'cat.forms', 'wcag2a', 'wcag412', 'wcag131', 'section508', 'section508.22.n', 'ACT' ],
23906
+ tags: [ 'cat.forms', 'wcag2a', 'wcag412', 'section508', 'section508.22.n', 'ACT' ],
23867
23907
  actIds: [ 'e086e5', '307n5z' ],
23868
23908
  all: [],
23869
23909
  any: [ 'implicit-label', 'explicit-label', 'aria-label', 'aria-labelledby', {
@@ -24183,7 +24223,7 @@
24183
24223
  }, {
24184
24224
  id: 'select-name',
24185
24225
  selector: 'select',
24186
- tags: [ 'cat.forms', 'wcag2a', 'wcag412', 'wcag131', 'section508', 'section508.22.n', 'ACT' ],
24226
+ tags: [ 'cat.forms', 'wcag2a', 'wcag412', 'section508', 'section508.22.n', 'ACT' ],
24187
24227
  actIds: [ 'e086e5' ],
24188
24228
  all: [],
24189
24229
  any: [ 'implicit-label', 'explicit-label', 'aria-label', 'aria-labelledby', {