Autocomplete: Clear is not working as expected #13026
Labels
LTS-FIXED-15.4.3
Fixed in PrimeNG LTS 15.4.3
LTS-PORTABLE
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When using the clear option in a single autocomplete, the clear button only clears the input not the actual value.
In multiple mode it clears the value.
This is quite confusing for the user as the autocomplete is obviously empty and therefore when saving anything, the value should be gone.
here is the code:
´´´js
clear() {
if (this.multiple) {
this.value = null;
}
else {
this.inputValue = null;
this.inputEL.nativeElement.value = '';
}
this.updateFilledState();
this.onModelChange(this.value);
this.onClear.emit();
}
```
In multiple mode the input won't be cleared, which is also wrong, as it is a different behaviour compared to the single mode.
And therefore it is incorrect to fire the onClear event, which states that the input was cleared and thats not the case
Environment
Doesn't matter
Reproducer
https://stackblitz.com/edit/github-sx74zq?file=src/app/app.component.ts
Angular version
15.x
PrimeNG version
15.4.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
16.x
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Clear should also clear the value of the ac
The text was updated successfully, but these errors were encountered: