angular / angular/components

bug(mat-menu-item): iconPositionEnd and matButtonIcon is not available for mat-menu-item

Offen
#27,006 4 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/menu P3 regression
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Is this a regression?

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

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

14.x

### Description

Since there was a change in mat-menu-item, that all icons are moved to the start, it is not possible anymore to place icons after the label. This breaks our current design (we have icons in front and after the label)

v15: https://github.com/angular/components/blob/15.2.x/src/material/menu/menu-item.html
v14: https://github.com/angular/components/blob/14.2.x/src/material/menu/menu-item.html

The solution would be to also support `iconPositionEnd` for mat-menu-items as it was done for mat-button.
https://github.com/angular/components/blob/15.2.x/src/material/button/button.html#L11

`matButtonIcon` should be supported as well.

_Bonus_: It would probably be even better to _not_ pull the icons automatically to a certain position (like it was before) or to have an additional attribute, so that an icon is not effected by the pulling (e.g. `iconPositionInline` --> `...`). I am not sure, if this is possible with the new mdc and the change happened in the first place, because the new css-class effected the icons. Nevertheless, iconPositionEnd should be possible.

Thank you!
~Manuel

### Reproduction

```

settings
Settings
open_in_new

```

### Expected Behavior

It should be possible to have buttons at the start and at the end (or inline).

### Actual Behavior

Both/all icons are in the start.

### Environment

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Vergleiche src/material/menu/menu-item.html in den Referenzen v15.2.x und v14.2.x und untersuche anschließend das zugehörige Beispiel src/material/button/button.html auf iconPositionEnd und matButtonIcon. Verwende die bereitgestellte mat-menu-item-Reproduktion mit Icons vor und nach dem Label; erledigt ist die Aufgabe, wenn das End-Icon am Ende bleiben kann, während das Start-Icon am Anfang bleibt.

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.