primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Autocomplete: Correctly typed input stays string instead of turning into an object

Open tomaszpuzio opened this issue 1 year ago • 1 comments

Describe the bug

When selecting any item from the list Autocomplete with objects works nice, however the problem starts when someone modifies the input. The ref variable stays string instead of becoming an object.

Reproducer

https://stackblitz.com/edit/primevue-create-vue-issue-template-zgsrkr?file=src%2FApp.vue,package.json

PrimeVue version

3.47.2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

ALL

Steps to reproduce the behavior

  1. Type United Kingdom and select United Kingdom from the dropdown list - selectedCountry is then an object
  2. Now remove last m letter and type it back
  3. Do not click on the item from the dropdown list but click outside the autocomplete component - selectedCountry stays string

Note that I am using in the example forceSelection prop.

Expected behavior

Even after modifying an input, if the input is correct (its typed value is in the dropdown list) I would expect the string to turn into an object when going out of focus.

tomaszpuzio avatar Feb 09 '24 10:02 tomaszpuzio

Thanks a lot for your report! I set a milestone for it. We'll check it before the milestone is released.

mertsincan avatar Feb 09 '24 11:02 mertsincan

When the input does not match any suggestions' object, it will remain a string and will turn into an empty string when the blur event occurs. This is expected behavior.

tugcekucukoglu avatar Apr 24 '24 10:04 tugcekucukoglu