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 does not convert to objects unless you select the option #17446

Open
1 of 4 tasks
theofidry opened this issue Jan 21, 2025 · 0 comments
Open
1 of 4 tasks
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@theofidry
Copy link

Describe the bug

When using the autocomplete component with objects, you can end up the case of having a valid input, but the control value not being an object.

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

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

Environment

macOS 14.6.1 (23G93)

Angular version

19.0.7

PrimeNG version

v19

Node version

22

Browser(s)

Chrome 131.0.6778.265 (Official Build) (arm64); Firefox 134.0 (aarch64)

Steps to reproduce the behavior

  • Go to the stackblitz
  • Type "United"
  • Select the option United Kingdom, the control value displayed is { "name": "United Kingdom", "code": "GB" } which is the expected result
  • Copy the input and paste it (in a more real-word usage, it would be the case of the user continuing to type and having his input perfectly matching the text of a suggestion). The control value displayed is "United Kingdom" and remains so even if on blur is triggered

Expected behavior

I would have expected the input to be transformed into an object whenever possible, not only on select

@theofidry theofidry added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant