Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoComplete: the forceSelection property causes inconsistent behavior when the value is removed #3161

Closed
alexandrapopa96 opened this issue Oct 25, 2022 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@alexandrapopa96
Copy link

Describe the bug

The forceSelection property setted on true causes inconsistent behavior when the value is removed.
If you already had a value in the input and you want to remove it and to type directly another one (without clicking outside the input after clearing it), the value will no longer have the correct format.
That will work correctly only if you click outside the input after clearing it.

Reproducer

https://codesandbox.io/s/young-feather-ytj6qn?file=/src/AutoCompleteDemo.vue

PrimeVue version

3.18.0

Vue version

3.x

Language

ES6

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Step 1. Type a full country name (ex: 'Italy'), and click outside the input, without selecting anything from the list

  • Result: the value will be automatically selected from the available options and will be displayed as an object, like this:
    {
    "name": "Italy",
    "code": "IT"
    }

Step 2. Remove all the text from the input and then continue with step 1

  • Result: the value will be only a string, not in a good format ('Italy')

Step 3. Remove again all the text, CLICK OUTSIDE the input and then continue with step 1

  • Result: the value will have again the correct format

Expected behavior

No response

@alexandrapopa96 alexandrapopa96 added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Oct 25, 2022
@alexandrapopa96 alexandrapopa96 changed the title AutoComplete: the forceSelection property causes inconsistent behavior when the value is removedComponent Name: Issue Title AutoComplete: the forceSelection property causes inconsistent behavior when the value is removed Oct 25, 2022
@tugcekucukoglu tugcekucukoglu added this to the 3.21.0 milestone Dec 5, 2022
@tugcekucukoglu tugcekucukoglu self-assigned this Dec 5, 2022
@alexandrapopa96
Copy link
Author

The problem persists also in v3.21.0. I reopened the issue and can be found here: #3525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants