p-autocomplete rendered autocomplete="off" on input element no longer works in Chrome

UI Components for Angular
Post Reply
aflorin
Posts: 69
Joined: 13 Dec 2017, 19:01

13 Jun 2019, 00:36

p-autocomplete renders autocomplete=off in the input elementRef in order to prevent chrome's cached autocomplete values from overlaying p-autocomplete's list box. However, chrome no longer honors that value. The current technique is to set autocomplete="no" ("no" being an unrecognized value by Chrome so it doesn't try to fill the input with stored values).

I initially tried using:

@ViewChild(AutoComplete) myAutoComplete: AutoComplete;

ngAfterViewInit() {
this.renderer.setElementAttribute(
this.myAutoComplete.inputEL.nativeElement,
"autocomplete",
"no");
}

Unfortunately, for some reason inputEL was undefined even though myAutoComplete was being rendered

I wound up having to fix it by manually modifying node_modules\primeng\components\autocomplete.metadata.json and setting autocomplete=\"off\" to autocomplete=\"no\"

I suggest the above be implemented in the next version of primeng to keep-up with Chrome's current behavior.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests