From 1f27d7041fe03025d4016ecda471c103837ba153 Mon Sep 17 00:00:00 2001 From: omergronich Date: Wed, 28 Jan 2026 16:45:33 +0200 Subject: [PATCH] fix(multiple): wrap ngDevMode check around afterRenderEffect in aria primitives Moving the ngDevMode check outside of afterRenderEffect ensures the effect is not registered at all in production, rather than registering an effect that does nothing. Affected packages: aria/listbox, aria/toolbar --- src/aria/listbox/listbox.ts | 8 ++++---- src/aria/toolbar/toolbar.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/aria/listbox/listbox.ts b/src/aria/listbox/listbox.ts index f1eef7ff83ea..87e08c9a62ed 100644 --- a/src/aria/listbox/listbox.ts +++ b/src/aria/listbox/listbox.ts @@ -159,14 +159,14 @@ export class Listbox { this._popup._controls.set(this._pattern as ComboboxListboxPattern); } - afterRenderEffect(() => { - if (typeof ngDevMode === 'undefined' || ngDevMode) { + if (typeof ngDevMode === 'undefined' || ngDevMode) { + afterRenderEffect(() => { const violations = this._pattern.validate(); for (const violation of violations) { console.error(violation); } - } - }); + }); + } afterRenderEffect(() => { if (!this._hasFocused()) { diff --git a/src/aria/toolbar/toolbar.ts b/src/aria/toolbar/toolbar.ts index afbe8bc51c44..6f29a9962af0 100644 --- a/src/aria/toolbar/toolbar.ts +++ b/src/aria/toolbar/toolbar.ts @@ -109,14 +109,14 @@ export class Toolbar { private _hasBeenFocused = signal(false); constructor() { - afterRenderEffect(() => { - if (typeof ngDevMode === 'undefined' || ngDevMode) { + if (typeof ngDevMode === 'undefined' || ngDevMode) { + afterRenderEffect(() => { const violations = this._pattern.validate(); for (const violation of violations) { console.error(violation); } - } - }); + }); + } afterRenderEffect(() => { if (!this._hasBeenFocused()) {