angular / angular/components

bug(aria/listbox): selection state breaks when used with ngCombobox autocomplete (readonly=false)

Ouverte
#32,712 1 commentaire 2 réactions 1 personne assignée Réclamée par @ok7sai Voir sur GitHub
area: aria/combobox P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

### 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

## Selection state breaks with autocomplete and readonly set to false

When using ngListbox in multi mode inside an ngCombobox with autocomplete enabled (filterMode="manual" and readonly=false), the listbox selection state becomes inconsistent.

### Important:
This issue does not occur when the combobox is set to readonly=true.

### Video

https://github.com/user-attachments/assets/4fb98448-69a6-491a-acd8-5912375a7a3e

### Reproduction

**StackBlitz link:** https://stackblitz.com/edit/stackblitz-starters-tzi9ff2a?file=src%2Fcombobox%2Fcombobox.html

**Steps to reproduce:**
1. Create an ngCombobox with:
a) filterMode="manual"
b) default editable input (readonly=false)
4. Render an ngListbox with multi enabled inside the combobox popup
5. Select options sequentially from the list
6. Observe listbox()?.values() after each selection ` listbox = viewChild>(Listbox);`

### Expected Behavior

## ngListbox in multi mode should

- preserve all selected values
- never reset selection unless explicitly cleared
- Combobox autocomplete input updates should not override or reset
- listbox multi-selection

### Actual Behavior

## Selection behavior is deterministic but incorrect

### Every second selection

- listbox()?.values() resets to an empty array
- The combobox input value remains unchanged

### Every third selection

The selected option becomes:

- the combobox input value
- the only value in listbox()?.values()
- This cycle repeats and makes listbox()?.values() unreliable for multi-selection state.

### Environment

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.