angular / angular/components

bug(MatSelect): When panel is displayed inside a SideNav, it stays opened on Escape button

Offen
#30,507 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: material/select area: material/sidenav P3
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

Hi,

When using MatSelect inside a SideNav, if the panel is opened and we close the sideNav with the Escape button, the MatSelect panel stays opened.

I expected the same behavior like with the MatDatePicker, if the picker panel is opened, when using Escape the picker is closed first, and then using Escape again closes the sideNav.

I also provide the same sample inside a Dialog using the MatSelect and MatDatePicker and in this case, both works the same way and correctly.

The issue seems related to this one:
https://github.com/angular/components/issues/7981

Thanks

### Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-r9az1u4q
Steps to reproduce:
1. Click on button to open the SideNav
2. Open the MatSelect panel
3. Click on Escape

### Expected Behavior

MatSelect should be closed with the escape button instead of the SideNav

### Actual Behavior

SideNav is closed and MatSelect panel stays visible

### Environment

- Angular: 18 (same issue in 19)
- CDK/Material: 18 (same issue in 19)
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und reproduziere die Escape-Sequenz in den Beispielen für SideNav, MatSelect und MatDatePicker. Vergleiche, wie MatSelect Escape verarbeitet, mit dem Verhalten des Pickers. Als abgeschlossen gilt, dass das MatSelect-Panel zuerst geschlossen wird und ein nachfolgendes Escape die SideNav schließt, einschließlich der Abdeckung des gemeldeten Setups.

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
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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