I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior
If user picks item by pressing enter and [forceSelection]="true", the selected item is cleared on blur event.
Expected behavior
The selected item should not be cleared.
Workaround based on autocomplete showcase stackblitz:
html (added [forceSelection]="true" #autocomplete):
ts (added viewchild and AfterViewInit):
https://stackblitz.com/edit/primeng-autocomplete-demo-jmejyt?file=src/app/app.component.html
Thanks for workaround.
I am facing the same issue. Thanks, @cyprianno for the workaround.
Thanks, @cyprianno! For posterity and convenience, I'm copying the workaround to the issue's comments:
Assign a template reference variable to the affected <p-autoComplete>:
<p-autoComplete #autocomplete ...>
Get a reference to the component in the code:
@ViewChild('autocomplete') autocomplete: AutoComplete;
In ngAfterViewInit, erase one of its event handlers:
ngAfterViewInit() {
this.autocomplete.onOverlayAnimationDone = (event) => {};
}
I'm curently working on a project that have too many autocompletes, making the workaround unviable.
Any news about fixing this bug?
We have the same problem, the worst of it is that we have more than 10000 autocompletes in the application, the palliative solution does not help us
I hope that this bug gets fixed soon. We are also using more than few autocompletes.
It is fixed in 11.0.0 (and LTS) with fixing issue #8740
Thanks, closing.
Most helpful comment
I'm curently working on a project that have too many autocompletes, making the workaround unviable.
Any news about fixing this bug?