From 7dd24778205c7e79040917b05da9afa0a02d8cdf Mon Sep 17 00:00:00 2001 From: Aaryan Choudhary Date: Mon, 24 Aug 2026 10:04:48 +0530 Subject: [PATCH 1/2] fix(frame): self-configure engine rules when the run command arrives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frames register a11y-engine rules via the one-shot CONFIGURE_A11YENGINE broadcast. A frame created after the broadcast, or whose window listeners were wiped by a document.write() rewrite (GPT ad creatives), keeps answering axe.ping/axe.start with a default audit and fails the whole run in normalizeRunOptions with 'unknown rule `fieldset-missing-legend` in options.rules'. The engine bundle in every frame already holds the rules and checks, and options.a11yEngineConfig already carries the engine flags with axe.start. Call a11yEngine.ensureConfigured(options) (added in a11y-engine-core) before running rules so the frame registers its engine rules from the config that travels with the command — no broadcast or listener dependency. Guarded no-op when the engine bundle is absent or the audit is already configured. Companion PR: browserstack/a11y-engine (a11yEngine.ensureConfigured). Co-Authored-By: Claude Fable 5 --- lib/core/public/load.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/core/public/load.js b/lib/core/public/load.js index ea69f3b69..33b71ef77 100644 --- a/lib/core/public/load.js +++ b/lib/core/public/load.js @@ -32,6 +32,20 @@ function runCommand(data, keepalive, callback) { switch (data.command) { case 'rules': + // [a11y-core]: engine rules are registered per-frame by the + // CONFIGURE_A11YENGINE broadcast, but a frame can miss or lose it — + // created after the broadcast fired, or its listeners wiped by a + // document.write() rewrite (GPT ad creatives). The engine bundle in + // this frame already holds the rules, and `options.a11yEngineConfig` + // carries the flags, so let the engine self-configure before the + // rules in options are validated. No-op when already configured or + // when the engine bundle is absent. + if ( + typeof a11yEngine !== 'undefined' && + typeof a11yEngine.ensureConfigured === 'function' + ) { + a11yEngine.ensureConfigured(options); + } return runRules( context, options, From d4fb245761c348e1375d4507504859da595f6c0f Mon Sep 17 00:00:00 2001 From: Aaryan Choudhary <76112295+Aaryan430@users.noreply.github.com> Date: Mon, 24 Aug 2026 15:28:52 +0530 Subject: [PATCH 2/2] Update load.js --- lib/core/public/load.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/core/public/load.js b/lib/core/public/load.js index 33b71ef77..b38bc941f 100644 --- a/lib/core/public/load.js +++ b/lib/core/public/load.js @@ -32,14 +32,7 @@ function runCommand(data, keepalive, callback) { switch (data.command) { case 'rules': - // [a11y-core]: engine rules are registered per-frame by the - // CONFIGURE_A11YENGINE broadcast, but a frame can miss or lose it — - // created after the broadcast fired, or its listeners wiped by a - // document.write() rewrite (GPT ad creatives). The engine bundle in - // this frame already holds the rules, and `options.a11yEngineConfig` - // carries the flags, so let the engine self-configure before the - // rules in options are validated. No-op when already configured or - // when the engine bundle is absent. + // [a11y-core]: rules are registered per-frame if ( typeof a11yEngine !== 'undefined' && typeof a11yEngine.ensureConfigured === 'function'