material-web icon indicating copy to clipboard operation
material-web copied to clipboard

Wrong placement of the icon in mwc-button in a mwc-dialog.

Open vdegenne opened this issue 4 years ago • 4 comments

Here's a reproduction

https://jsbin.com/qeconuw/edit?html,output

The icon in the mwc-button is not aligned with the text, when used in a mwc-dialog.

Last year I opened this issue : https://github.com/material-components/material-components-web-components/issues/1045 for the same reason. It was fixed, but recently I noticed that the misplacement appears again.

vdegenne avatar Jan 30 '21 18:01 vdegenne

Hey @vdegenne

Thanks for providing a jsbin to reference!

Here's a jsbin where the icon in mwc-button is centered and styled correctly by using the slot property on your 'open' button.

<mwc-button slot="primaryAction"> ...
<mwc-button slot="secondaryAction"> ...

We control the styling more heavily in our slotted actions.

I wouldn't recommend putting buttons in a mwc-dialog ourside the "primaryAction" and "secondaryAction" slots. The intention of dialog is to have a 'yes / no' or 'okay / cancel' relationship between the user, the dialog, and dialog's actions (the buttons).

taylor-vann avatar Feb 04 '21 20:02 taylor-vann

It's still technically a wayward CSS property inheritance so I will be taking ownership of this bug :) Thanks for submitting!

taylor-vann avatar Feb 05 '21 22:02 taylor-vann

Anything new on this ? Thanks

christophe-g avatar Jul 07 '21 11:07 christophe-g

I am the author of this post. After almost a whole year this bug is still there. Can we hope to see this fixed soon? Maybe levelling up the priority? as it is common to have buttons with icon in dialogs.

Thanks

vdegenne avatar Oct 16 '21 11:10 vdegenne

Fixed in M3

asyncliz avatar Aug 02 '23 02:08 asyncliz

M3 for the win! :+1:

vdegenne avatar Aug 02 '23 06:08 vdegenne