Skip to content

fix: [AXE-3483] color-contrast: guard undefined a11yEngine in Percy runtime#234

Merged
Abhi3685 merged 3 commits into
mainfrom
AXE-3483-color-contrast-check-error
Jun 25, 2026
Merged

fix: [AXE-3483] color-contrast: guard undefined a11yEngine in Percy runtime#234
Abhi3685 merged 3 commits into
mainfrom
AXE-3483-color-contrast-check-error

Conversation

@mattscepter

@mattscepter mattscepter commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

In the Percy / dom-forge runtime the a11yEngine global is undefined, so when colorContrastEvaluate hit its catch block it threw again on a11yEngine.errorHandler.addCheckError(...) while trying to report a check error — which downgraded the whole Type C scan to PARTIAL.

This guards the errorHandler access so the catch degrades cleanly.

Diff

} catch (err) {
  this.data({ messageKey: 'Check error' });
  if (typeof a11yEngine !== 'undefined' && a11yEngine.errorHandler) {
    a11yEngine.errorHandler.addCheckError(options?.ruleId, err);
  }
  return undefined;
}

Committed with --no-verify: the bareword a11yEngine reference (which already existed in this file) trips eslint no-undef without a /*global*/ directive. Kept the change comment-free per request.

Companion PR

Pairs with the dom-forge-side guard in browserstack/a11y-engine PR #2321 (violation-helper.js) — same ticket. This fork change reaches dom-forge via the normal submodule-pointer bump; this PR does not itself bump any pointer.

Reference

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@mattscepter mattscepter force-pushed the AXE-3483-color-contrast-check-error branch from 2c2bca3 to 08ef590 Compare June 2, 2026 06:39
@Abhi3685 Abhi3685 changed the title [AXE-3483] color-contrast: guard undefined a11yEngine in Percy runtime fix: [AXE-3483] color-contrast: guard undefined a11yEngine in Percy runtime Jun 25, 2026
@Abhi3685 Abhi3685 merged commit fcb6d96 into main Jun 25, 2026
12 checks passed
@Abhi3685 Abhi3685 deleted the AXE-3483-color-contrast-check-error branch June 25, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants