Skip to content

Commit

Permalink
Update password field to resolve bug introduced with max length change
Browse files Browse the repository at this point in the history
  • Loading branch information
chromaticWaster committed Oct 1, 2024
1 parent 8ec7dcb commit 4b27499
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/password-field/PasswordField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,13 @@ export class PasswordField extends OmniFormElement {
}
}

// Set the value of the input component.
_setInputValue() {
if (this._inputElement) {
// If the input has a value and the max length property is set then slice the value according to the max length.
if (this._inputElement?.value && this.maxLength) {
if (this._inputElement.value.length > this.maxLength) {
this._inputElement.value = this._inputElement.value.slice(0, this.maxLength);
}
if (this.maxLength) {
this._inputElement.value = this.value?.slice(0, this.maxLength) as string;
} else {
this._inputElement.value = this.value as string;
}
this.value = this._inputElement?.value;
}
}

Expand Down

0 comments on commit 4b27499

Please sign in to comment.