angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.73k forks source link

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

Open mangei opened 1 year ago

mangei commented 1 year ago

Is this a regression?

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 --> <mat-icon iconPositionInline>...</mat-icon>). 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

<button mat-menu-item>
   <mat-icon>settings</mat-icon>
   Settings
   <mat-icon>open_in_new</mat-icon>
</button>

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

behzadmehrabi commented 1 year ago

I'd be happy to make a PR for it, if possible.

enkodereddsanchez commented 1 year ago

I have the same problem. Do yoy have any solution? 😢

stnor commented 11 months ago

I have the same problem. Do yoy have any solution? 😢

Add an inner div with a flex layout and put the text and the icon in it.