components icon indicating copy to clipboard operation
components copied to clipboard

Dialog with fixed height less than 100% has 2 scrollbars

Open tytskyi opened this issue 9 years ago • 13 comments

Bug

What is the expected behavior?

Dialog with fixed height, that is less than 100% to have only one scroll bar - for content section.

What is the current behavior?

Dialog has 2 scrollbars - 1 for content and 1 for the whole dialog.

What are the steps to reproduce?

https://plnkr.co/edit/1teyLZLR7MVsrZLPD94V?p=preview

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

2 scrollbars is weak user-experience.

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

Browsers: Chrome (Windows 10, Lunix Ubuntu 16.04 LTS), IE11 (Windows 10) Material: 2.0.0-beta.6, 2.0.0-beta.8 OS, Typescript - not applicable

Is there anything else we should know?

Probably the same is applicable to fixed width, but lets not noise the issue with it.

tytskyi avatar Aug 22 '17 11:08 tytskyi

It seems ok over here (Chrome, Windows 10);

image

julianobrasil avatar Aug 22 '17 22:08 julianobrasil

@julianobrasil could you shrink browser vertically?

image

I have this problem on 2 laptops + 1 desktop monitor

  • Laptop 1, 13" full hd
  • Laptop 2, 13" 4k
  • Desktop monitor 24" regular resolution

tytskyi avatar Aug 22 '17 22:08 tytskyi

It happened with the browser shrinked.

julianobrasil avatar Aug 22 '17 22:08 julianobrasil

Is there any temporary solution I can apply, until this is fixed?

surachaitanya avatar Feb 06 '18 09:02 surachaitanya

The issue is still happening with fixed height:

const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
      height: '400px',
      width: '250px',
      data: {name: this.name, animal: this.animal}
    });

https://stackblitz.com/edit/angular-axeibr

mergin avatar May 07 '19 06:05 mergin

Came here for a solution and it's happening to me as well with a fixed height dialog. Same as the previous post. It only happens for me if I use the mat-dialog-content directive to wrap my content. Otherwise the main dialog scrollbar is the only one present.

Use cases: fixed height on dialog use mat-dialog-content directive double scroll bars

fixed height on dialog no mat-dialog-content single scroll bar, but not fixed header

no fixed height on dialog use mat-dialog-content-directive single scroll bar, but not the height I want.

mycroft16 avatar Jun 07 '19 06:06 mycroft16

Almost another year has passed by and this error still persists. No news whatsoever on this?

tommueller avatar May 05 '20 08:05 tommueller

@andrewseguin @crisbeto Could you please look into this again. As @mycroft16 stated the problem is not there when you don't use the mat-dialog-content slot... But when you do that and you have focus on the action buttons on init of dialog, you do not see the dialog title. And for the content only the bottom part... image

So if you use the dialog as it is supposed to be, to have "sticky" header title and footer actions, you get this: image

Test stackblitz

The expected result would be: image

Therefore you need to look at the dialog config if there is a value present "height" or "maxHeight" and according to those values, calculations need to be made to set the correct "height" or "maxHeight" on the mat-dialog-content as inline styling (same as for the panel)... In our example this would be "max-height: 256px". We need to do this because the mat-dialog-content class has a fixed "responsive" height, being "max-height: 65vh;".

Thanks for looking into it and please do keep us posted!

Laurensvdw avatar Mar 12 '21 11:03 Laurensvdw

this is very annoying. is there any way around?

brandart avatar Feb 10 '22 09:02 brandart

is there now a fix?

RueDeRennes avatar Apr 15 '22 05:04 RueDeRennes

Is this bug fixed by any chance ?

nikhil-clearcals avatar Apr 30 '22 11:04 nikhil-clearcals

I have a workaround. I was able to solve the issue by adding this styles to .mat-dialog-container and dialog component:

.mat-dialog-container {
  overflow: unset;
  display: flex;
  flex-direction: column;

  dialog-content-example-dialog {
    display: flex;
    flex-direction: column;
    min-height: 1px;
  }
}

This is how it looks like: image Stackblitz example

uncleGera avatar May 04 '22 18:05 uncleGera

It's a big problem particularly iOS devices as the actions buttons zoom out with full screen modal but if you set maxHeight it brings scrollbar for android devices.

masum7 avatar Apr 06 '23 00:04 masum7