question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting dialog max-height does not work

See original GitHub issue

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!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:13

github_iconTop GitHub Comments

16reactions
joschnecommented, Dec 11, 2019

I think I found a relatively simple solution.

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

10reactions
jhuietcommented, 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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 8: max-height attribute for a material dialog is not ...
Here when dialog get open, maxWidth: '100vw' works fine where as maxHeight: '100vh' is not supported. Also tried maxHeight: '100vh !important' ...
Read more >
Dialog: Auto height does not respect the maxHeight option.
If you have a very large dialog box with the height option set to 'auto', and the max height option defined, the height...
Read more >
How to Setting maxHeight to the Dialog in Angular Dialog ...
By default, the maxHeight for the Dialog is calculated based on the target. If the target is not specified externally, the Dialog consider...
Read more >
Dialog sometimes ignores max height - Java Bug System
Dialogs sometimes ignores the max height when the pref height of the dialog content is bigger. This will lead to a visual glitch...
Read more >
maxHeight - API Reference - Kendo UI Dialog - Documentation
In this article you can see how to configure the maxHeight property of the ... The maximum height (in pixels) that may be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found