angular / angular/components

bug(Autocomplete): Selected option is not deselected when first input is removed while panel is closed (without clicking on input field for focus)

Offen
#31,229 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/autocomplete P4
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Selected option does not get deselected when the input is cleared (without clicking on input field for focus) while the panel is closed.

https://github.com/user-attachments/assets/3930b00b-7131-4b98-b29b-597b8883eb94

### Reproduction

StackBlitz link:
Steps to reproduce:
1. Click on autocomplete input field.
2. Select an option from the list.
3. Hit backspace from keyboard. (NOTE - don't click on the input to focus the field so that the panel remains closed while hitting backspace)
4. On first backspace - the selection (checkmark) remains on the previously selected option and the panel gets opened.
5. On second backspace - the selection gets cleared because panel was already open.

### Expected Behavior

The selection should get cleared since the input value has changed.

### Actual Behavior

The selection does not get cleared.

### Environment

- Angular:
- CDK/Material:
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die beschriebene Angular-Autocomplete-Sequenz zu reproduzieren: Wähle eine Option aus, lasse das Panel geschlossen und drücke Backspace, ohne das Eingabefeld erneut zu fokussieren. Verfolge, wie die erste Eingabeänderung mit der ausgewählten Option und dem Panel-Status umgeht. Erledigt ist es, wenn die Auswahl beim ersten Backspace gelöscht wird, während das Panel geschlossen ist; im Issue werden keine Datei und kein Test genannt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.