Skip to content

Commit

Permalink
fix(checkbox): update isInvalid on report & check validity
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Nov 28, 2024
1 parent b35aefa commit 0c3ff26
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class OdsCheckbox {

@Method()
public async checkValidity(): Promise<boolean | undefined> {
this.isInvalid = !this.inputEl?.validity.valid;
return this.inputEl?.checkValidity();
}

Expand All @@ -57,6 +58,7 @@ export class OdsCheckbox {

@Method()
public async reportValidity(): Promise<boolean | undefined> {
this.isInvalid = !this.inputEl?.validity.valid;
return this.inputEl?.reportValidity();
}

Expand Down Expand Up @@ -130,10 +132,10 @@ export class OdsCheckbox {
id={ this.inputId }
indeterminate={ this.isIndeterminate }
name={ this.name }
onInvalid={ (e): void => this.onInvalidEvent(e) }
onBlur={ (): void => this.onBlur() }
onFocus={ (): CustomEvent<void> => this.odsFocus.emit() }
onInput={ (): void => this.onInput() }
onInvalid={ (e): void => this.onInvalidEvent(e) }
onKeyUp={ (event: KeyboardEvent): void => this.inputEl && submitFormOnEnter(event, this.inputEl.form) }
ref={ (el): HTMLInputElement => this.inputEl = el as HTMLInputElement }
required={ this.isRequired }
Expand Down

0 comments on commit 0c3ff26

Please sign in to comment.