Autocomplete: ForceSelection does not force selection - formControl value is changed even without selection #14389
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When at Autocomplete we'll set flag: forceSelection = true, it was expected that below formControl value will change only after actual selection of a value from the client - especially if it's dropdown. Though, the value is changed on every key press and also nullified just a split second after selecting proper value, to, after that, being set properly.
Environment
Found at: PrimeNg v16.9.1 + Angular: 16.2.12
Recreated at: PrimeNg v17.1.0 + Angular: 17.0.2
Probably it was introduced at v16.7.0 when acccessibility changes.
Reproducer
https://stackblitz.com/edit/whnszi?file=src%2Fapp%2Fdemo%2Fautocomplete-reactive-forms-demo.html
Angular version
17.0.2
PrimeNG version
17.1.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.6.0+
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
In console, there will be just one record with filtered country object. So it means valueChanges will be invoked only once - at country selection.
Probably whole thing is done by this difference (missing flag check):
Cause then the updateModel actually calls onModelChange, which earlier on was only called after flag check:
I don't know if this is just a mistake or a change made with a reason, that I need to prepare my app for.
The text was updated successfully, but these errors were encountered: