Skip to content

Commit

Permalink
fix(primeng/p-chips): not unfocus input when disabled for firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
volvachev authored and Egor Volvachev committed Oct 12, 2022
1 parent c2b9110 commit 3087220
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/components/chips/chips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,20 @@ export class Chips implements AfterContentInit,ControlValueAccessor {
}
}

updateMaxedOut() {
updateMaxedOut(): void {
if (this.inputViewChild && this.inputViewChild.nativeElement) {
if (this.max && this.value && this.max === this.value.length)
if (this.max && this.value && this.max === this.value.length) {
// Calling `blur` is necessary because firefox does not call `onfocus` events
// for disabled inputs, unlike chromium browsers.
this.inputViewChild.nativeElement.blur();
this.inputViewChild.nativeElement.disabled = true;
else
} else {
if (this.disabled) {
this.inputViewChild.nativeElement.blur();
}

this.inputViewChild.nativeElement.disabled = this.disabled || false;
}
}
}
}
Expand Down

0 comments on commit 3087220

Please sign in to comment.