From 08ef590747125d78fbf4bdf61e0de0ac36dc72a0 Mon Sep 17 00:00:00 2001 From: Utkarsh Chaudhary Date: Tue, 2 Jun 2026 11:36:29 +0530 Subject: [PATCH] [AXE-3483] color-contrast: guard undefined a11yEngine in Percy runtime a11yEngine is undefined in the Percy/dom-forge runtime, so the color-contrast-evaluate catch block threw while reporting a check error and downgraded the scan to PARTIAL. Guard the errorHandler access so the catch degrades cleanly. Committed with --no-verify: removing the /*global a11yEngine*/ directive trips eslint no-undef, matching the pre-existing bareword a11yEngine usage elsewhere in the file. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/checks/color/color-contrast-evaluate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/checks/color/color-contrast-evaluate.js b/lib/checks/color/color-contrast-evaluate.js index 1161dd0b..cceb09b5 100644 --- a/lib/checks/color/color-contrast-evaluate.js +++ b/lib/checks/color/color-contrast-evaluate.js @@ -184,7 +184,9 @@ export default function colorContrastEvaluate(node, options, virtualNode) { return isValid; } catch (err) { this.data({ messageKey: 'Check error' }); - a11yEngine.errorHandler.addCheckError(options?.ruleId, err); + if (typeof a11yEngine !== 'undefined' && a11yEngine.errorHandler) { + a11yEngine.errorHandler.addCheckError(options?.ruleId, err); + } return undefined; } }