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

Component autocomplete selects items with same "startWith" values when in both multiple and forceSelection modes #16493

Open
simon-budin-tcy opened this issue Oct 4, 2024 · 1 comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@simon-budin-tcy
Copy link

Describe the bug

This is a very specific scenario: using a p-autocomplete component with both "multiple" and "forceSelection" set to true leads to double selection when several items start with the same name (e.g. "flower" and "flower2") and when we search for the substring "flower" and when the value "flower2" is selected with the mouse.

Environment

node v18.19.1
angular 18.0.1
windows 11

Reproducer

https://stackblitz.com/edit/w6y19s?file=src%2Fapp%2Fautocomplete-basic-demo.html

Angular version

18.0.1

PrimeNG version

17.18.11

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.19.1

Browser(s)

Chrome, Firefox (don't know about Safari)

Steps to reproduce the behavior

  1. Create a p-autocomplete with both [forceSelection]="true" and [multiple]="true"
  2. On search event, bind an array of suggestions where 2 items start with the same substring, e.g. "flower" and "flower2"
  3. Search for the substring "flower"
  4. With the mouse, click on "flower2"
  5. Observce that two chips "flower" and "flower2" are added into the field and into selectedSuggestions model

Expected behavior

A single chip with "flower2" gets selected and added into selectedSuggestions model.

@simon-budin-tcy simon-budin-tcy added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 4, 2024
@konarx
Copy link

konarx commented Nov 1, 2024

+1.
I just bumped into this issue today.

@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 19, 2024
@mertsincan mertsincan added this to the 17.18.13 milestone Nov 19, 2024
@mertsincan mertsincan modified the milestones: 17.18.13, 17.x Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
Status: No status
Development

No branches or pull requests

3 participants