Skip to content

Commit a7ca074

Browse files
authored
fix(UUIFormControlMixin): dont call setAttribute in the constructor (#931)
1 parent 992d7f9 commit a7ca074

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/uui-base/lib/mixins/FormControlMixin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ export const UUIFormControlMixin = <
180180
public get pristine(): boolean {
181181
return this._pristine;
182182
}
183-
private _pristine: boolean = true;
183+
// Will be set to true instantly to trigger the setAttribute in the setter.
184+
// This is to prevent an issue caused by using setAttribute in the constructor.
185+
private _pristine: boolean = false;
184186

185187
/**
186188
* Apply validation rule for requiring a value of this form control.
@@ -221,7 +223,7 @@ export const UUIFormControlMixin = <
221223
constructor(...args: any[]) {
222224
super(...args);
223225
this._internals = this.attachInternals();
224-
this.setAttribute('pristine', '');
226+
this.pristine = true;
225227

226228
this.addValidator(
227229
'valueMissing',

0 commit comments

Comments
 (0)