primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Autocomplete: Do not clear input on Backspace

Open gianluca-moro opened this issue 4 months ago • 0 comments

Describe the bug

Using p-autocomplete with [showClear]="true" (and without multiple mode) will clear the whole input at once when pressing Backspace.

Our team and clients think this behaviour is counter-intuitive since pressing Backspace normally clears inputs character by character. If we want to clear the whole input we can click the clear icon, which is the whole purpose of it.

Also, the current behaviour seems to be inconsistent anyway: If we set the value programatically, pressing Backspace clears character by character. But, if we set the value through the UI, Backspace clears the whole input.

Environment

Primeng: 17.18.11 Angular: 18.2.3

Reproducer

https://stackblitz.com/edit/x8zv8g-kh1qmo?file=src%2Fapp%2Fautocomplete-show-clear-demo.html

Angular version

18.2.3

PrimeNG version

17.18.11

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.19.1

Browser(s)

Firefox 131.0.3, Chrome 129.0.6668.101

Steps to reproduce the behavior

  1. Open Stackblitz reproducer
  2. Select item in autocomplete dropdown
  3. Press Backspace on keyboard

Expected behavior

Backspace should always delete character by character, unless in [multiple]="true" mode.

gianluca-moro avatar Oct 17 '24 08:10 gianluca-moro