primeng icon indicating copy to clipboard operation
primeng copied to clipboard

AutoComplete onSelect bug with forceSelection

Open tiagodws opened this issue 8 years ago • 4 comments

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

Plunkr Case (Bug Reports) Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.

https://stackblitz.com/edit/github-6uaqnt

Current behavior onSelect is called twice when the user types a valid value and the autocomplete is on forceSelection mode.

Expected behavior onSelect should be called a single time.

Minimal reproduction of the problem with instructions

https://stackblitz.com/edit/github-6uaqnt

  • Type exactly the value of a valid suggestion (e.g. "BR")
  • Click on ANY suggestion
  • Observe that the value of the autocomplete will change twice, and the onSelect will be called twice as well.

What is the motivation / use case for changing the behavior? This behavior invalidates the main use of the onSelect event: to know when the user has truly selected a suggestion. If the user searches for a name (e.g. "John"), intending to select a "John Silver", but there is an option with just "John", the onSelect will be wrongly called for "John" as well.

Please tell us about your environment:

  • Angular version: 7.X
  • PrimeNG version: 7.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

tiagodws avatar Dec 03 '18 15:12 tiagodws

It seems to be only on the first selection. After that it just fires once. Interesting.

BobFleischman avatar Dec 04 '18 23:12 BobFleischman

Hello, that bug is also present in version 6.1.7. For pratical reasons, i can't switch to angular 7. Can I switch to primeng 7 or is it only compatible with angular 7? Or is there going to be further update of primeng 6.x? Thanks in advance

dafranklin avatar Jan 25 '19 13:01 dafranklin

@cagataycivici @yigitfindikli The problem still persists on 7.0.5

tiagodws avatar Feb 22 '19 17:02 tiagodws

Still happening.

jcmendes9898 avatar Dec 09 '19 12:12 jcmendes9898