Setting dialog max-height does not work
See original GitHub issueBug, 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:
- Created 6 years ago
- Reactions:9
- Comments:13
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I found a relatively simple solution.
See stackblitz example and my comments in dialog-content-example.ts.
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…