components icon indicating copy to clipboard operation
components copied to clipboard

MdDialog container padding does not match spec

Open LOZORD opened this issue 9 years ago • 9 comments

Bug, feature request, or proposal:

MdDialog (<md-dialog-container>) currently pads the entire child (user-supplied) content with 24px. It should not pad the action content (or rather, pad according to the spec).

What is the expected behavior?

It should only pad the non-action content. Source

What is the current behavior?

It pads all the content. screenshot from 2017-01-20 11 20 43

What are the steps to reproduce?

See here.

What is the use-case or motivation for changing an existing behavior?

To match the Material spec.

Which versions of Angular, Material, OS, browsers are affected?

Angular & Material: current OS: any/all

Is there anything else we should know?

n/a

LOZORD avatar Jan 20 '17 16:01 LOZORD

Have we found a fix for this? I can remove the 24px padding via Chrome Dev Tools as .mat-dialog-container but not within CSS.

Haske107 avatar Aug 17 '17 07:08 Haske107

I need to remove the padding on the mat-dialog-container which is now default at 24px. Pls suggest if any way to remove or override it.

prabhat112 avatar Dec 05 '17 07:12 prabhat112

as a workaround you can put this to your global styles (src/styles.css) .mat-dialog-container { padding: 0 !important; }

Viktor-Bredihin avatar Dec 14 '17 21:12 Viktor-Bredihin

i have more than 1 dialog if im using :

.mat-dialog-container { padding: 0 !important; } all my dialog padding is 0 how to specify the padding is 0 on the selected dialog ?

arzazahrian avatar Dec 27 '17 02:12 arzazahrian

Try this work around, its a bit extreme having to use view encapsulation but worked for me. https://stackoverflow.com/questions/42306850/need-to-find-css-selector-for-material-design-2s-md-dialog-container

yhalwani avatar Jan 03 '18 15:01 yhalwani

Here is my solution, which i think will work for most of the cases, without messing with the view encapsulation prop.

  • First set custom class on your dialog box
this.dialog.open(myDialogComponent, {
  panelClass: 'my-dialog'
 });
  • Second - put the custom css in your global style.scss and target whatever you feel like (the container in this case)
.my-dialog {
    .mat-dialog-container {
		padding: 0;
		background: none;
                 {{And all the rest of the css you need}}
     }
}

Xapuu avatar Feb 23 '18 10:02 Xapuu

you can Simply check this to remove the useless padding

// Add this to your global stylesheet after your theme setup .myapp-no-padding-dialog .mat-dialog-container { padding: 0; }

this.dialog.open(MyDialogComponent, {panelClass: 'myapp-no-padding-dialog'})

AMohamedZaki avatar Apr 10 '18 15:04 AMohamedZaki

Closing this issue since the 2018 updates to the Material Design spec will supersede what's described here.

jelbourn avatar May 09 '18 21:05 jelbourn

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.