diff --git a/.github/workflows/Semgrep.yml b/.github/workflows/Semgrep.yml index df56d237..9d993cea 100644 --- a/.github/workflows/Semgrep.yml +++ b/.github/workflows/Semgrep.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: {} # Scan mainline branches and report all findings: push: - branches: ["master", "main"] + branches: ['master', 'main'] # Schedule the CI job (this method uses cron syntax): schedule: - cron: '20 17 * * *' # Sets Semgrep to scan every day at 17:20 UTC. @@ -17,8 +17,8 @@ on: jobs: semgrep: # User definable name of this GitHub Actions job. - name: semgrep/ci - # If you are self-hosting, change the following `runs-on` value: + name: semgrep/ci + # If you are self-hosting, change the following `runs-on` value: runs-on: ubuntu-latest container: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 704b3842..fb7ba06a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,4 +53,4 @@ jobs: - uses: actions/download-artifact@v5 with: name: axe-core - - run: npm run test:node \ No newline at end of file + - run: npm run test:node diff --git a/axe.d.ts b/axe.d.ts index 786b30a2..82722edd 100644 --- a/axe.d.ts +++ b/axe.d.ts @@ -386,10 +386,8 @@ declare namespace axe { frameContext: FrameContextObject; } - interface RawCheckResult extends Omit< - CheckResult, - 'relatedNodes' | 'impact' - > { + interface RawCheckResult + extends Omit { relatedNodes?: Array; impact?: ImpactValue; } diff --git a/lib/checks/color/color-contrast-evaluate.js b/lib/checks/color/color-contrast-evaluate.js index 4ccbbe33..e12d2f62 100644 --- a/lib/checks/color/color-contrast-evaluate.js +++ b/lib/checks/color/color-contrast-evaluate.js @@ -17,6 +17,7 @@ import { import { memoize } from '../../core/utils'; export default function colorContrastEvaluate(node, options, virtualNode) { + // a11y-color-contrast : Wrap entire check in try/catch try { const { ignoreUnicode, diff --git a/lib/checks/color/link-in-text-block-evaluate.js b/lib/checks/color/link-in-text-block-evaluate.js index 5c98fd9f..420f2789 100644 --- a/lib/checks/color/link-in-text-block-evaluate.js +++ b/lib/checks/color/link-in-text-block-evaluate.js @@ -135,10 +135,12 @@ function getColorContrast(node, parentBlock) { nodeColor = getForegroundColor(node); parentColor = getForegroundColor(parentBlock); + // a11y-critical : If nodeColor is missing, set to transparent black if (!nodeColor) { nodeColor = new axe.commons.color.Color(0, 0, 0, 0); } + // a11y-critical : If parentColor is missing, set to transparent black if (!parentColor) { parentColor = new axe.commons.color.Color(0, 0, 0, 0); } diff --git a/lib/checks/label/label-content-name-mismatch-evaluate.js b/lib/checks/label/label-content-name-mismatch-evaluate.js index e79d99fe..f5b72c88 100644 --- a/lib/checks/label/label-content-name-mismatch-evaluate.js +++ b/lib/checks/label/label-content-name-mismatch-evaluate.js @@ -8,6 +8,7 @@ import { // eslint-disable-next-line no-restricted-imports import stem from 'wink-porter2-stemmer'; +// a11y-rule-label-content-name-mismatch: Similarity threshold for text comparison const threshold = 0.75; function cleanText(str) { @@ -18,6 +19,7 @@ function cleanText(str) { .trim(); } +// a11y-rule-label-content-name-mismatch: Replace special characters with text equivalents function replaceSynonyms(text) { const synonymMap = { '&': 'and' @@ -28,6 +30,7 @@ function replaceSynonyms(text) { .join(' '); } +// a11y-rule-label-content-name-mismatch: Normalize and stem text for comparison function stringStemmer(str) { return replaceSynonyms(str) .split(/[^\p{L}\p{N}]+/u) @@ -43,27 +46,8 @@ function stringStemmer(str) { .join(' '); } -/** - * Check if a given text exists in another - * - * @param {String} compare given text to check - * @param {String} compareWith text against which to be compared - * @returns {Boolean} - */ -function isStringContained(compare, compareWith) { - compare = stringStemmer(compare); - compareWith = stringStemmer(compareWith); - - const curatedCompareWith = curateString(compareWith); - const curatedCompare = curateString(compare); - if (!curatedCompareWith || !curatedCompare) { - return false; - } - const res = curatedCompareWith.includes(curatedCompare); - if (res) { - return res; - } - +// a11y-rule-label-content-name-mismatch: Calculate cosine similarity between strings +function isCosineSimilar(compare, compareWith) { const tokensA = compare.split(/[^\p{L}\p{N}]+/u); const tokensB = compareWith.split(/[^\p{L}\p{N}]+/u); const freqA = {}, @@ -92,6 +76,31 @@ function isStringContained(compare, compareWith) { return similarity >= threshold; // comparision with threshold as 75% } +/** + * + * @param {String} compare given text to check + * @param {String} compareWith text against which to be compared + * @returns {Boolean} + */ +function isStringContained(compare, compareWith) { + // a11y-rule-label-content-name-mismatch: Apply stemming normalization + compare = stringStemmer(compare); + // a11y-rule-label-content-name-mismatch: Apply stemming normalization + compareWith = stringStemmer(compareWith); + + const curatedCompareWith = curateString(compareWith); + const curatedCompare = curateString(compare); + if (!curatedCompareWith || !curatedCompare) { + return false; + } + // a11y-rule-label-content-name-mismatch: Fallback to cosine similarity comparison + const res = curatedCompareWith.includes(curatedCompare); + if (res) { + return res; + } + return isCosineSimilar(curatedCompare, curatedCompareWith); +} + /** * Curate given text, by removing emoji's, punctuations, unicode and trim whitespace. * @@ -103,7 +112,7 @@ function curateString(str) { emoji: true, nonBmp: true, punctuations: true, - whitespace: true + whitespace: true // a11y-rule-label-content-name-mismatch : To Skip for whitespace }); return sanitize(noUnicodeStr); } @@ -119,7 +128,7 @@ function labelContentNameMismatchEvaluate(node, options, virtualNode) { ignoreIconLigature: true, pixelThreshold, occurrenceThreshold, - ignoreNativeTextAlternative: true // To Skip for nativeTextAlternative + ignoreNativeTextAlternative: true // a11y-rule-label-content-name-mismatch : To Skip for nativeTextAlternative }) ).toLowerCase(); diff --git a/lib/commons/color/get-foreground-color.js b/lib/commons/color/get-foreground-color.js index d4ed670b..70bdceb3 100644 --- a/lib/commons/color/get-foreground-color.js +++ b/lib/commons/color/get-foreground-color.js @@ -39,7 +39,7 @@ export default function getForegroundColor(node, _, bgColor, options = {}) { } fgColors = fgColors.concat(color); - // If any color in the array is fully opaque, break + // a11y-critical : If any color in the array is fully opaque, break if (Array.isArray(color)) { if (color.some(c => c && c.alpha === 1)) { break; @@ -49,6 +49,7 @@ export default function getForegroundColor(node, _, bgColor, options = {}) { } } + // a11y-critical : If any color in the array is fully opaque, break if (!fgColors.length) { // Could not determine foreground color incompleteData.set('fgColor', 'No foreground color found'); @@ -63,14 +64,14 @@ export default function getForegroundColor(node, _, bgColor, options = {}) { bgColor ??= getBackgroundColor(node, []); if (bgColor === null) { - // Return the foreground color as-is if background color is not found + // a11y-critical : the foreground color as-is if background color is not found return fgColor; } const stackingContexts = getStackingContext(node); const context = findNodeInContexts(stackingContexts, node); - // If context is not found, fallback to blending with bgColor only + // a11y-critical : If context is not found, fallback to blending with bgColor only if (!context) { return flattenColors(fgColor, bgColor); } diff --git a/lib/commons/dom/create-grid.js b/lib/commons/dom/create-grid.js index 7af1b001..64a78432 100644 --- a/lib/commons/dom/create-grid.js +++ b/lib/commons/dom/create-grid.js @@ -27,7 +27,7 @@ export default function createGrid( ) { // Prevent multiple calls per run if (cache.get('gridCreated') && !parentVNode) { - // a11y-engine-domforge change + // a11y-domforge : returning data from cache if available if (cache.get('gridSize')) { return cache.get('gridSize'); } @@ -115,7 +115,7 @@ export default function createGrid( node = treeWalker.nextNode(); } - // a11y-engine-domforge change + // a11y-domforge : returning data from cache if available if (cache.get('gridSize')) { return cache.get('gridSize'); } @@ -439,7 +439,7 @@ class Grid { * @returns {number} */ toGridIndex(num) { - // a11y-engine-domforge change + // a11y-domforge : returning data from cache if available if (cache.get('gridSize')) { return Math.floor(num / cache.get('gridSize')); } @@ -456,7 +456,7 @@ class Grid { const rowIndex = this.toGridIndex(y); const colIndex = this.toGridIndex(x); - // a11y-engine-domforge change + // a11y-domforge : special handling for resize-2x-zoom rule if (cache.get('ruleId') === 'resize-2x-zoom') { if (!isPointInRect({ y: rowIndex, x: colIndex }, this.boundaries)) { return []; diff --git a/lib/commons/dom/get-element-stack.js b/lib/commons/dom/get-element-stack.js index 4f094725..5707771e 100644 --- a/lib/commons/dom/get-element-stack.js +++ b/lib/commons/dom/get-element-stack.js @@ -10,7 +10,7 @@ import getNodeGrid from './get-node-grid'; * @return {Node[]} */ -// Additional props isCoordsPassed, x, y for a11y-engine-domforge +// a11y-domforge : Additional props isCoordsPassed, x, y function getElementStack(node, isCoordsPassed = false, x = null, y = null) { const grid = getNodeGrid(node); if (!grid) { @@ -18,7 +18,7 @@ function getElementStack(node, isCoordsPassed = false, x = null, y = null) { } const rect = getNodeFromTree(node).boundingClientRect; - // Additional props isCoordsPassed, x, y for a11y-engine-domforge + // a11y-domforge : Additional props isCoordsPassed, x, y return getRectStack(grid, rect, false, isCoordsPassed, x, y); } diff --git a/lib/commons/dom/get-overflow-hidden-ancestors.js b/lib/commons/dom/get-overflow-hidden-ancestors.js index 24cbb23e..ad5bac73 100644 --- a/lib/commons/dom/get-overflow-hidden-ancestors.js +++ b/lib/commons/dom/get-overflow-hidden-ancestors.js @@ -18,7 +18,7 @@ const getOverflowHiddenAncestors = memoize( const overflow = vNode.getComputedStylePropertyValue('overflow'); - // a11y-engine-domforge change + // a11y-domforge : special handling for resize-2x-zoom rule if (cache.get('ruleId') && cache.get('ruleId') === 'resize-2x-zoom') { if ( overflow.includes('hidden') || @@ -28,7 +28,9 @@ const getOverflowHiddenAncestors = memoize( ) { ancestors.push(vNode); } - } else if ( + } + // a11y-domforge : special handling for reflow-4x-zoom-scroll and color-contrast rules + else if ( cache.get('ruleId') && (cache.get('ruleId') === 'reflow-4x-zoom-scroll' || cache.get('ruleId') === 'color-contrast') && diff --git a/lib/commons/dom/get-rect-stack.js b/lib/commons/dom/get-rect-stack.js index 36489a50..1febe5ca 100644 --- a/lib/commons/dom/get-rect-stack.js +++ b/lib/commons/dom/get-rect-stack.js @@ -1,7 +1,7 @@ import visuallySort from './visually-sort'; import { getRectCenter } from '../math'; -// Additional props isCoordsPassed, x, y for a11y-engine-domforge +// a11y-domforge : Additional props isCoordsPassed, x, y export function getRectStack( grid, rect, @@ -16,7 +16,7 @@ export function getRectStack( let floorX = Math.floor(center.x); let floorY = Math.floor(center.y); - // a11y-engine-domforge change + // a11y-domforge : Use passed coordinates if provided if (isCoordsPassed) { floorX = Math.floor(x); floorY = Math.floor(y); diff --git a/lib/commons/dom/get-visible-child-text-rect.js b/lib/commons/dom/get-visible-child-text-rect.js index acb4213c..0146c064 100644 --- a/lib/commons/dom/get-visible-child-text-rect.js +++ b/lib/commons/dom/get-visible-child-text-rect.js @@ -31,7 +31,7 @@ const getVisibleChildTextRect = memoize( clientRects.push(...filterHiddenRects(contentRects, overflowHiddenNodes)); }); - // a11y-engine-domforge change + // a11y-domforge : If no visible text rects found, return empty array if (clientRects.length <= 0) { return []; } diff --git a/lib/commons/dom/get-visible-child-text-rects.js b/lib/commons/dom/get-visible-child-text-rects.js index 7b56fc09..e7b63791 100644 --- a/lib/commons/dom/get-visible-child-text-rects.js +++ b/lib/commons/dom/get-visible-child-text-rects.js @@ -11,6 +11,7 @@ import cache from '../../core/base/cache'; * @instance * @param {Element} node */ +// a11y-domforge : added options to control certain behaviors const getVisibleChildTextRects = (node, options = {}) => { const { checkTextRectOutsideNodeBoundingRect = false, @@ -36,6 +37,7 @@ const getVisibleChildTextRects = (node, options = {}) => { nodeRect, checkTextRectOutsideNodeBoundingRect ) && + // a11y-domforge : early return for certain rules (!cache.get('ruleId') || cache.get('ruleId') === 'reflow-4x-zoom-scroll' || cache.get('ruleId') === 'color-contrast') @@ -51,7 +53,7 @@ const getVisibleChildTextRects = (node, options = {}) => { ); }); - // a11y-engine-domforge change + // a11y-domforge : handle case when no visible text rects found if ( clientRects.length <= 0 && ((cache.get('ruleId') && cache.get('ruleId') === 'resize-2x-zoom') || @@ -91,6 +93,7 @@ function getContentRects(node) { * when determining the rect stack we will also use the midpoint * of the text rect to determine out of bounds */ +// a11y-domforge : added checkTextRectOutsideNodeBoundingRect option function isOutsideNodeBounds( rects, nodeRect, diff --git a/lib/commons/dom/is-in-text-block.js b/lib/commons/dom/is-in-text-block.js index 0b1f068a..e0073277 100644 --- a/lib/commons/dom/is-in-text-block.js +++ b/lib/commons/dom/is-in-text-block.js @@ -5,6 +5,7 @@ import getRoleType from '../aria/get-role-type'; function walkDomNode(node, functor) { if (functor(node.actualNode) !== false) { + // a11y-critical : avoid processing STYLE elements if ( functor(node.actualNode) !== false && node.actualNode.nodeName !== 'STYLE' diff --git a/lib/commons/text/native-text-alternative.js b/lib/commons/text/native-text-alternative.js index 0d87ba60..b6e2b995 100644 --- a/lib/commons/text/native-text-alternative.js +++ b/lib/commons/text/native-text-alternative.js @@ -10,6 +10,7 @@ import nativeTextMethods from './native-text-methods'; * @return {String} Accessible text */ export default function nativeTextAlternative(virtualNode, context = {}) { + // a11y-rule-label-content-name-mismatch : Skip native text alternative if specified if (context.ignoreNativeTextAlternative) { return ''; } diff --git a/lib/commons/text/remove-unicode.js b/lib/commons/text/remove-unicode.js index 96562ea9..03572284 100644 --- a/lib/commons/text/remove-unicode.js +++ b/lib/commons/text/remove-unicode.js @@ -20,6 +20,7 @@ import { emojiRegexText } from '../../core/imports'; * @returns {String} */ function removeUnicode(str, options) { + // a11y-rule-label-content-name-mismatch : remove whitespace characters const { emoji, nonBmp, punctuations, whitespace } = options; if (emoji) { @@ -34,6 +35,7 @@ function removeUnicode(str, options) { if (punctuations) { str = str.replace(getPunctuationRegExp(), ''); } + // a11y-rule-label-content-name-mismatch : remove whitespace characters if (whitespace) { str = str.replace(/\s+/g, ''); } diff --git a/lib/commons/text/subtree-text.js b/lib/commons/text/subtree-text.js index 239cec16..76ed413d 100644 --- a/lib/commons/text/subtree-text.js +++ b/lib/commons/text/subtree-text.js @@ -59,6 +59,7 @@ function subtreeText(virtualNode, context = {}) { const phrasingElements = getElementsByContentType('phrasing').concat(['#text']); +// a11y-core : Skip inline elements with overflow hidden function skipByInlineOverflow(virtualNode) { const computedStyleOverflow = virtualNode._cache.computedStyle_overflow; if (computedStyleOverflow && computedStyleOverflow === 'hidden') { @@ -68,6 +69,7 @@ function skipByInlineOverflow(virtualNode) { } function appendAccessibleText(contentText, virtualNode, context) { + // a11y-core : Skip inline elements with overflow hidden when specified in context if ( context.ignoreNativeTextAlternative && skipByInlineOverflow(virtualNode) diff --git a/lib/core/base/rule.js b/lib/core/base/rule.js index d5c41d60..f12cdbd6 100644 --- a/lib/core/base/rule.js +++ b/lib/core/base/rule.js @@ -255,6 +255,7 @@ Rule.prototype.run = function run(context, options = {}, resolve, reject) { try { // Matches throws an error when it lacks support for document methods nodes = this.gatherAndMatchNodes(context, options); + // a11y-critical : Cache the number of nodes gathered for this rule cache.set(this.id, nodes.length); } catch (error) { reject(error); diff --git a/lib/core/public/configure.js b/lib/core/public/configure.js index abc432ca..1cf73d64 100644 --- a/lib/core/public/configure.js +++ b/lib/core/public/configure.js @@ -52,7 +52,6 @@ function configure(spec) { spec.checks.forEach(check => { if (!check.id) { throw new TypeError( - `Configured check ${JSON.stringify( check )} is invalid. Checks must be an object with at least an id property` @@ -72,7 +71,6 @@ function configure(spec) { spec.rules.forEach(rule => { if (!rule.id) { throw new TypeError( - `Configured rule ${JSON.stringify( rule )} is invalid. Rules must be an object with at least an id property` diff --git a/lib/core/public/load.js b/lib/core/public/load.js index 5e339280..ea69f3b6 100644 --- a/lib/core/public/load.js +++ b/lib/core/public/load.js @@ -39,7 +39,7 @@ function runCommand(data, keepalive, callback) { // Serialize all DqElements results = nodeSerializer.mapRawResults(results); - //a11y-engine iframe rules error merging logic + // a11y-critical : iframe rules error merging logic const errors = a11yEngine.getErrors(); if (Object.keys(errors).length !== 0) { if ( diff --git a/lib/core/public/run-rules.js b/lib/core/public/run-rules.js index 1729144f..68dfd64f 100644 --- a/lib/core/public/run-rules.js +++ b/lib/core/public/run-rules.js @@ -66,7 +66,7 @@ export default function runRules(context, options, resolve, reject) { // after should only run once, so ensure we are in the top level window if (context.initiator) { - // Return a11y-engine errors when at top level window + // a11y-critical : Return a11y-engine errors when at top level window if ( results.length > 0 && results[results.length - 1]?.a11yEngineErrors diff --git a/lib/core/utils/aggregate-checks.js b/lib/core/utils/aggregate-checks.js index 48a5226e..3eda2d3a 100644 --- a/lib/core/utils/aggregate-checks.js +++ b/lib/core/utils/aggregate-checks.js @@ -67,6 +67,7 @@ function aggregateChecks(nodeResOriginal) { nodeResult[type].forEach(check => impacts.push(check.impact)); }); + // a11y-critical : Removed define impact for failed nodes nodeResult.impact = aggregate(constants.impact, impacts); // Delete the old result and priority properties diff --git a/lib/core/utils/check-helper.js b/lib/core/utils/check-helper.js index 71960bac..32130291 100644 --- a/lib/core/utils/check-helper.js +++ b/lib/core/utils/check-helper.js @@ -25,6 +25,7 @@ function checkHelper(checkResult, options, resolve, reject) { data(data) { checkResult.data = data; }, + // a11y-critical : Added getCheckData method getCheckData() { return checkResult.data; }, diff --git a/lib/core/utils/dq-element.js b/lib/core/utils/dq-element.js index 48f393e1..acb9fae0 100644 --- a/lib/core/utils/dq-element.js +++ b/lib/core/utils/dq-element.js @@ -10,7 +10,7 @@ import VirtualNode from '../../core/base/virtual-node/virtual-node'; const CACHE_KEY = 'DqElm.RunOptions'; -// a11y-engine change for runTypeAOpt +// a11y-critical : change for runTypeAOpt function truncate(str, maxLength) { maxLength = maxLength || 300; @@ -128,7 +128,7 @@ export function truncateElement(element) { } /** - * Escapes a string for use in CSS selectors + * a11y-critical : Escapes a string for use in CSS selectors * @param {String} str - The string to escape * @returns {String} The escaped string */ @@ -142,6 +142,8 @@ function escapeCSSSelector(str) { .replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, '\\$&') .replace(/^\d/, '\\3$& '); } + +// a11y-critical : funtion to generate selector with shadow DOM support function generateSelectorWithShadow(elm) { const selectors = getShadowSelector(elm); if (typeof selectors === 'string') { @@ -152,6 +154,7 @@ function generateSelectorWithShadow(elm) { } } +// a11y-critical : function to get shadow DOM selector function getShadowSelector(elm) { if (!elm) { return ''; @@ -176,6 +179,7 @@ function getShadowSelector(elm) { return stack.map(item => getFullPathSelector(item.elm)); } +// a11y-critical : function to get full path selector function getFullPathSelector(elm) { if (elm.nodeName === 'HTML' || elm.nodeName === 'BODY') { return elm.nodeName.toLowerCase(); @@ -230,6 +234,7 @@ function getFullPathSelector(elm) { return selector; } +// a11y-critical : optimized getSource function with caching function getSourceOpt(element) { if (!element) { return ''; @@ -338,6 +343,7 @@ const DqElement = memoize(function DqElement(elm, options, spec) { this.source = null; // TODO: es-modules_audit if (!axe._audit.noHtml) { + // a11y-critical : Differentiate source generation based on runTypeAOpt if (axe._cache.get('runTypeAOpt')) { this.source = this.spec.source ?? getSourceOpt(this._element); } else { @@ -354,9 +360,11 @@ DqElement.prototype = { * @return {String} */ get selector() { + // a11y-critical : change for ancestry if (axe._cache.get('targetFormat') === 'ancestry') { return this.spec.selector || [getAncestry(this.element)]; } + // a11y-critical : Differentiate selector generation based on runTypeAOpt if (axe._cache.get('runTypeAOpt')) { return this.spec.selector || [generateSelectorWithShadow(this.element)]; } diff --git a/lib/core/utils/get-ancestry.js b/lib/core/utils/get-ancestry.js index a7eae695..b98f3096 100644 --- a/lib/core/utils/get-ancestry.js +++ b/lib/core/utils/get-ancestry.js @@ -13,7 +13,7 @@ function generateAncestry(node) { parentElement?.children.length > 1 ) { let index = 0; - // a11y-engine changes + // a11y-critical : change to ignore injected Percy elements when calculating :nth-child if (parentElement.nodeName === 'BODY') { let count = 0; // Single pass over siblings: count valid children & locate node position. diff --git a/lib/core/utils/get-selector.js b/lib/core/utils/get-selector.js index e7216818..d6d810e1 100644 --- a/lib/core/utils/get-selector.js +++ b/lib/core/utils/get-selector.js @@ -376,7 +376,7 @@ function generateSelector(elm, options, doc) { } else { selector = features; } - // If there are too many similar element running QSA again is faster + // a11y-critical : If there are too many similar element running QSA again is faster if (!similar || similar.length > constants.selectorSimilarFilterLimit) { similar = findSimilar(doc, selector); } else { @@ -406,11 +406,11 @@ function getSelector(elm, options) { return getShadowSelector(generateSelector, elm, options); } -// Axe can call getSelector more than once for the same element because +// a11y-critical : Axe can call getSelector more than once for the same element because // the same element can end up on multiple DqElements. export default memoize(getSelector); -// Similar elements create similar selectors. If there are lots of similar elements on the page, +// a11y-critical : Similar elements create similar selectors. If there are lots of similar elements on the page, // axe ends up needing to run that same selector many times. We can memoize for a huge perf boost. const findSimilar = memoize((doc, selector) => Array.from(doc.querySelectorAll(selector)) diff --git a/lib/core/utils/merge-errors.js b/lib/core/utils/merge-errors.js index 7fffe01e..da85f002 100644 --- a/lib/core/utils/merge-errors.js +++ b/lib/core/utils/merge-errors.js @@ -1,4 +1,4 @@ -// Function to merge errors for a11y-engine. +// a11y-critical : Function to merge errors for a11y-engine. // Handles errors differently for check_errors and other errors. // It also adds the target selector to the errors for better identification. diff --git a/lib/core/utils/performance-timer.js b/lib/core/utils/performance-timer.js index 4b5626d3..945ed444 100644 --- a/lib/core/utils/performance-timer.js +++ b/lib/core/utils/performance-timer.js @@ -90,6 +90,7 @@ const performanceTimer = (() => { * @param {String} endMark String name of mark to end measuring */ measure(measureName, startMark, endMark, details = {}) { + // a11y-critical : try-catch to avoid breaking axe run in case of any error try { if (window.performance && window.performance.measure !== undefined) { if (Object.keys(details).length > 0) { diff --git a/lib/standards/aria-roles.js b/lib/standards/aria-roles.js index cd49dc37..c82a6167 100644 --- a/lib/standards/aria-roles.js +++ b/lib/standards/aria-roles.js @@ -1,3 +1,4 @@ +// a11y-ip: ARIA Roles are defined here // Source: https://www.w3.org/TR/wai-aria-1.1/#roles // Source for abstract roles (types): https://www.w3.org/TR/wai-aria/#abstract_roles