components icon indicating copy to clipboard operation
components copied to clipboard

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

Open mangei opened this issue 1 year ago • 3 comments

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

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

mangei avatar Apr 28 '23 12:04 mangei

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

behzadmehrabi avatar May 09 '23 17:05 behzadmehrabi

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

enkodereddsanchez avatar May 30 '23 04:05 enkodereddsanchez

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.

stnor avatar Sep 25 '23 10:09 stnor