From 1d0eac41f4588139ef1fc769ede0f42014e479eb Mon Sep 17 00:00:00 2001 From: JesmoDev <26099018+JesmoDev@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:08:45 +0200 Subject: [PATCH] dont call setAttribute in the constructor --- packages/uui-base/lib/mixins/FormControlMixin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/uui-base/lib/mixins/FormControlMixin.ts b/packages/uui-base/lib/mixins/FormControlMixin.ts index 5c7ee4680..9f1d12e1d 100644 --- a/packages/uui-base/lib/mixins/FormControlMixin.ts +++ b/packages/uui-base/lib/mixins/FormControlMixin.ts @@ -180,7 +180,9 @@ export const UUIFormControlMixin = < public get pristine(): boolean { return this._pristine; } - private _pristine: boolean = true; + // Will be set to true instantly to trigger the setAttribute in the setter. + // This is to prevent an issue caused by using setAttribute in the constructor. + private _pristine: boolean = false; /** * Apply validation rule for requiring a value of this form control. @@ -221,7 +223,7 @@ export const UUIFormControlMixin = < constructor(...args: any[]) { super(...args); this._internals = this.attachInternals(); - this.setAttribute('pristine', ''); + this.pristine = true; this.addValidator( 'valueMissing',