Skip to content

Commit

Permalink
Merge pull request #12038 from volvachev/fix-chips-blur-events
Browse files Browse the repository at this point in the history
fix(primeng/p-chips): not unfocus input when disabled for firefox
  • Loading branch information
cetincakiroglu authored Oct 18, 2022
2 parents b18aaa2 + 3087220 commit f1ede6c
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 f1ede6c

Please sign in to comment.