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

Chips: After clicking the clear button does not allow to input values #13011

Closed
avytak opened this issue May 10, 2023 · 2 comments · Fixed by #13030
Closed

Chips: After clicking the clear button does not allow to input values #13011

avytak opened this issue May 10, 2023 · 2 comments · Fixed by #13030
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@avytak
Copy link

avytak commented May 10, 2023

Describe the bug

When we set the max and showClear attributes for the p-chips:
<p-chips [addOnBlur]="true" [showClear]="true" [max]="5"></p-chips>
After that type the max possible values (in that case 5) and press the clear button, the input is still disabled.

Environment

Windows 10

Reproducer

https://stackblitz.com/edit/primeng-chips-maxitems-bug?file=src%2Fapp%2Fapp.component.html

Angular version

14.2.0

PrimeNG version

14.2.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.16.0

Browser(s)

Chrome 113.0.5672.92

Steps to reproduce the behavior

  1. Go to chips input.
  2. Enter any 5 values.
  3. Click the clear icon.
  4. Try to enter any value after that.
  5. Observe

Expected behavior

After the clicking clear button I should be able to write the value again.
A possible reason could be that clear method does not have updateMaxedOut method:

clear() { this.value = null; this.updateFilledState(); this.onModelChange(this.value); this.onClear.emit(); }

@avytak avytak added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 10, 2023
@avytak
Copy link
Author

avytak commented May 10, 2023

One more thing that I found is that when we have [addOnBlur]="true" and typed the last allowed item and press the "Enter" - it duplicate it in the input field, so we have 6 items rather than 5. You can reproduce it in the same stackblitz code example. Is this the right behavior?

@irekBudzowski
Copy link

irekBudzowski commented Aug 3, 2023

One more thing that I found is that when we have [addOnBlur]="true" and typed the last allowed item and press the "Enter" - it duplicate it in the input field, so we have 6 items rather than 5. You can reproduce it in the same stackblitz code example. Is this the right behavior?

@avytak you are right.
As a team workaround, if your business case accepts it, you might set [allowDuplicate]=false so onBlur won't duplicate the last element.

@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Aug 26, 2023
@mertsincan mertsincan added this to the 16.2.1 milestone Aug 26, 2023
mertsincan pushed a commit that referenced this issue Aug 26, 2023
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
3 participants