Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MdDialog width configuration uncenter dialog. #3239

Closed
yudielcurbelo opened this issue Feb 22, 2017 · 10 comments · May be fixed by #9236
Closed

MdDialog width configuration uncenter dialog. #3239

yudielcurbelo opened this issue Feb 22, 2017 · 10 comments · May be fixed by #9236
Assignees
Labels
area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@yudielcurbelo
Copy link

Bug, feature request, or proposal:

Bug: MdDialog not centered when is open passing a configuration of a custom width.

What is the expected behavior?

MdDialog should be the size of the specified width but keep his center location.

What is the current behavior?

MdDialog is being moved to the left.

What are the steps to reproduce?

https://plnkr.co/edit/fvG6lS8VIihJUlfu01Bv?p=preview

openDialog() { this.dialog.open(DialogOverviewExampleDialog, { width: '600px' }); }

image

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

Material 2.0.0-beta.2
Chrome in Windows

@crisbeto crisbeto self-assigned this Feb 22, 2017
@crisbeto
Copy link
Member

This happens when the dialog hits the max width and is an issue with how we have the dialog set up in general. I'll be reworking it once #3184 is merged.

@mmalerba mmalerba added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Feb 24, 2017
@LilSebastian5000
Copy link

LilSebastian5000 commented Mar 2, 2017

@crisbeto Is there a known workaround for this at the moment? Is there a way to apply styling to ".mat-dialog-container" for now that I'm unaware of? When I attempt to set a style to that class in my styleUrl sheet, it is ignored, since it is launched after the page is loaded from a button click.

@crisbeto
Copy link
Member

crisbeto commented Mar 2, 2017

There is no nice workaround @ryanpm40. Technically adding a max-width to the .cdk-overlay-pane should fix it, but the cdk-overlay-pane is used for all overlay-based Material components. Now that #3184 is merged, I can do a proper fix for it, though.

@LilSebastian5000
Copy link

LilSebastian5000 commented Mar 2, 2017

@crisbeto Gotcha, thanks for the update! I suppose another temporary option for me would be to use some javascript to get the class element (but obviously not very ideal):

let containerElem:HTMLElement = <HTMLElement>document.getElementsByClassName('mat-dialog-container')[0];
containerElem.style.width="900px";

Looking forward to those changes :)

@MA-Maddin
Copy link
Contributor

MA-Maddin commented Jun 27, 2017

I like the current behaviour that it get shrinked when the config's width gets hit, since a dialog should never be larger than screen I guess!?

Only problem is that it isn't centered anymore then.

Adding margin: auto to .mat-dialog-container does the trick.

https://github.com/angular/material2/blob/70b31f177a2dacfd08f47b2a8898fca3f7bb91f9/src/lib/dialog/dialog.scss#L19

So workaround for that is adding this to global stylesheet:

md-dialog-container {
    margin: auto;
}

http://plnkr.co/edit/yYM6kBUQQe2lQJcVKdcP?p=preview

@willshowell
Copy link
Contributor

As another solution, you can add a panelClass to the dialog and then apply whatever css just to that specific dialog.

this.dialog.open(MyDialogComponent, {
  panelClass: 'my-full-screen-dialog',
  data: { ... }
});
.my-full-screen-dialog .mat-dialog-container {
  max-width: none;
  width: 100vw;
  height: 100vh;
}

@zijianhuang
Copy link

thanks willshowell. This works well, and elegantly enough.

@julianobrasil
Copy link
Contributor

julianobrasil commented Jul 4, 2017

@willshowell , I was testing the feature above, but I must be doing something terribly wrong. I tried to change background color of the backdrop panel and/or of the panel, but it seems to have no effect at all.

Is it working properly? Plunker: https://plnkr.co/edit/OjPQdv6Txqcn1v5nXG3p?p=preview

@willshowell
Copy link
Contributor

@julianobrasil the styles must be global or without view encapsulation 😁

https://plnkr.co/edit/lGFjGSmhlr9tOoHK1gJp?p=preview

crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
@crisbeto crisbeto added the has pr label Jan 4, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 12, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
jelbourn pushed a commit that referenced this issue Jan 21, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 24, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 2, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 30, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 18, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
josephperrott pushed a commit that referenced this issue May 30, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.
andrewseguin pushed a commit that referenced this issue Jun 7, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 11, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 12, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
jelbourn pushed a commit that referenced this issue Aug 23, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.
jelbourn pushed a commit that referenced this issue Aug 25, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes #2481.
Fixes #3239.
Fixes #6584.
Fixes #8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 7, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 24, 2018
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 1, 2019
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 30, 2019
* Improves the handling of scrollable content inside the `mat-dialog-content` by using flexbox, rather than a hardcoded `max-height`, to define the content height. This resolves various issues where the dialog would go out of the screen at certain screen sizes or have multiple scrollbars.
* Uses flexbox to ensure that the dialog content elements are always at the appropriate size.

Fixes angular#2481.
Fixes angular#3239.
Fixes angular#6584.
Fixes angular#8493.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants