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

Setting dialog max-height does not work #8493

Open
swftvsn opened this issue Nov 16, 2017 · 14 comments · May be fixed by #9236
Open

Setting dialog max-height does not work #8493

swftvsn opened this issue Nov 16, 2017 · 14 comments · May be fixed by #9236
Labels
area: material/dialog P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@swftvsn
Copy link
Contributor

swftvsn commented Nov 16, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

To be able to change the max-height of the dialog

What is the current behavior?

It does not work.

What are the steps to reproduce?

http://plnkr.co/edit/X17ETao12PtHTKmpqV5s?p=preview
The dialog in question is configured to be

const settings: MatDialogConfig = {
  maxWidth: '99vw',
  maxHeight: '99vh'
}

But the height is the default one. It seems that the cdk-overlay-0 is correctly styled with style="max-width: 99vw; max-height: 99vh;" but the inner div.mat-dialog-content has max-height: 65vh; which dictates the height.

All the relevant code is in app.component.ts.

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

All / latest

Is there anything else we should know?

Keep up the good work!

@RobertPaulson90
Copy link

Same issue :(

@crisbeto crisbeto added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Nov 28, 2017
@diogodomanski
Copy link

Did you try to set height and/or width too?

const settings: MatDialogConfig = {
  maxWidth: '99vw',
  maxHeight: '99vh',

  width: '99vw',
  height: '99vh'
}

@wojtek1150
Copy link

Same issue

@RobertPaulson90
Copy link

My case was a user issue, what I wanted was minHeight

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 crisbeto linked a pull request Jan 4, 2018 that will close this issue
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.
@mstawick
Copy link

mstawick commented Feb 6, 2018

FYI, as a workaround I've applied maxHeight via panelClass class, and then it works as expected (as far as I can tell).

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.
@dgroh
Copy link

dgroh commented Nov 26, 2018

same issue

@insidewhy
Copy link

The .mat-dialog-content has a fixed max height of 65vh, so setting a maxHeight (or even minHeight) beyond 65vh can lead to trouble. You have to override the css at the same time.

@insidewhy
Copy link

I've been fighting this with a designer for about 24 hours now, there are a large number of barriers to getting the dialog styled correctly. It almost seems as if many material components are too limited when it comes to customization options. One of the other designers I'm working with is also starting to get disillusioned with how difficult it can be to use anything but the restrictive defaults.

@drorm
Copy link

drorm commented Feb 1, 2019

Seems like doing something like the following works.

.mat-dialog-content { max-height: 95%; }

@fuzolan
Copy link

fuzolan commented Feb 25, 2019

Seems like doing something like the following works.

.mat-dialog-content { max-height: 95%; }

had no effect in my case. A simple fullscreen option would be nice. If you want to use mat-dialog-actions then you get another problems...

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.
@jhuiet
Copy link

jhuiet commented May 9, 2019

I know this isn't the 'best' practice, but I found a simple fix for me: an inline style addition!

<mat-dialog-content style="max-height: 85vh">

This was where I landed after needing scrolling on smaller screens (note the mat-dialog-content tag) and not wanting scrolling on larger screens...

@akvaliya
Copy link

Any progress on this issue? It's been long time. I am facing the same issue. maxHeight has no effect on dialog.

@joschne
Copy link

joschne commented Dec 11, 2019

I think I found a relatively simple solution.

See stackblitz example and my comments in dialog-content-example.ts.

@tsupryk
Copy link

tsupryk commented Jun 13, 2023

Having same issue in latest Material v15 !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.