components icon indicating copy to clipboard operation
components copied to clipboard

Dialog position and size problems

Open HarelM opened this issue 9 years ago • 37 comments

Bug

Dialog position and size are not working well:

  1. Dialog position does not respect bottom (or I didn't understand what it stand for).
  2. When dialog is too long action buttons can not be accessed.
  3. When using a small device the dialog is not centered.
  4. This is more of a UX issue - when dialog has a dynamic content - content change leads to dialog size change which is a not a good user experience.

What is the expected behavior?

There are a few bugs here:

  1. when setting bottom - the lower end of the dialog location should be fixed.
  2. action buttons should always be reachable (even if it requires scrolling).
  3. dialog should be centered on small devices.
  4. I would say that a non dynamic (at least in terms of width) dialog would create better user experience, see my comments at the end.

What is the current behavior?

As described in the bug.

What are the steps to reproduce?

https://plnkr.co/edit/fwCkVfkc04BBwguHT00p?p=preview 4. does not exist in the above plunker, but dynamic content change of dialog content should present what I define as a not so good UX.

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

Bad user experience.

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

angular 4.0.3 material 2.0 beta 3.

Is there anything else we should know?

I'm migrating my code from angularjs to angular and from angular-bootstrap-ui to angular material. The modal in angular bootstrap is behaving well in all the terms I have listed above and creates a very nice user experience, I think it's worth looking at its behavior.

HarelM avatar May 15 '17 21:05 HarelM

  1. is a real pain on mobile devices. I had to remove the title to display the action buttons. Would be great to get this fixed soon.

ghost avatar May 29 '17 08:05 ghost

Any updates on this? This is a blocker for publishing my site to production...

HarelM avatar May 31 '17 01:05 HarelM

My personal favorite is that setting config.height to 100% will leave you with 35% of the bottom of the dialog as useless whitespace. Why is this not dynamic like how ng-material does it with flex box?

DanRibbens avatar Jun 05 '17 20:06 DanRibbens

+1 Please make it possible to style dialogs for Mobile Devices.

SvenBudak avatar Jun 26 '17 11:06 SvenBudak

It would be better to use a custom class to acheive this probably but I ended up getting by with some css that looks like this for a dialog with config 100% for height and width on mobile only.

.mat-dialog-container {
    display: flex !important;
    flex-direction: column;
}

.mat-dialog-container > * {
    display: flex;
    flex-direction: column;
}

.mat-dialog-content {
    max-height: inherit !important;
}

.mat-dialog-actions {
    display: block !important;
    flex-grow: inherit;
    flex-shrink: inherit;
    padding: 12px 0 0 !important;

    &:last-child {
        margin-bottom: 0 !important;
    }
}

I don't love it, but it does what I wanted.

DanRibbens avatar Jun 26 '17 12:06 DanRibbens

And What you guys think about this?:

let dialogRef = dialog.open(UserProfileComponent, {
  height: '400px',
  width: '600px',
});

It make it impossible to make it Responsive, but maybe i missunderstand this function?

SvenBudak avatar Jun 26 '17 13:06 SvenBudak

I'm not following your question @BamiGorengo. 600px wide isn't going to work on portrait orientation for most mobile devices. The snippet I gave above was for making a full screen dialog on mobile. If you give it a height and width of 100% it does OK and doesn't seem to cause any harm for lesser percents. In my case the dialog is being used to show more than a mobile screen worth of content.

I have not played around with specifying the number of pixels. What is it you are trying to do?

DanRibbens avatar Jun 26 '17 17:06 DanRibbens

Any updates on this? While the workaround provided by @DanRibbens might work the dialog still looks bad. The fact that this kind of issue (which I believe is critical) is now open more than a month and a half is a major turn-off for me...

HarelM avatar Jul 06 '17 22:07 HarelM

FWIW I was able to center the dialog with this:

// global styles
.my-centered-dialog {
  max-width: 80vw;

  .mat-dialog-container {
    max-width: none;
  }
}
this.dialog.open(MyComponent, {
  panelClass: 'my-centered-dialog',
  width: '512px'
});

...but I agree, the whole size/positioning experience could be improved.

willshowell avatar Jul 25 '17 15:07 willshowell

Is anyone from the maintainers looking into this? My users are suffering... :-((( The main UI rejects I get are on the dialogs I create are due to flickering size changes and header taking too much space. I don't know how to make it better but it has to go through a major overhaul...

HarelM avatar Aug 27 '17 22:08 HarelM

@HarelM I don't know if it's just me, but your plnkr is breaking for me. Would you mind taking a look and updating?

emilio-martinez avatar Oct 03 '17 17:10 emilio-martinez

Sure, I'll update it later on tonight. But the problem definition in the initial comment describes most of the issues. You can use the plunker from the documentation of material and play with it to see the horrors :-)

HarelM avatar Oct 03 '17 17:10 HarelM

You can see some of the issues described above in the following plunker: https://plnkr.co/edit/kb5zEClufOQ5elS2f499?p=preview I think item 3 had been solved though.

HarelM avatar Oct 04 '17 07:10 HarelM

It keep breaking. Use the following code inside the dialog html file:

<div mat-dialog-title>
  <h1>Hi</h1>
  <h1>Hi</h1>
  <h1>Hi</h1>
  <h1>Hi</h1>
  <h1>Hi</h1>
</div>
<div mat-dialog-content>
  <p>What's your favorite animal?</p>
  <mat-form-field>
    <input matInput tabindex="1" [(ngModel)]="data.animal">
  </mat-form-field>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
  <p>What's your favorite animal?</p>
</div>
<div mat-dialog-actions>
  <button mat-button [mat-dialog-close]="data.animal" tabindex="2">Ok</button>
  <button mat-button (click)="onNoClick()" tabindex="-1">No Thanks</button>
</div>

HarelM avatar Oct 07 '17 09:10 HarelM

Any news on this? The following plunker still looks hideous: https://plnkr.co/edit/zkWK2VLzhnu4JI3mlUJf?p=preview Are you guys seriously planning on creating a release candidate with this bug open?

HarelM avatar Nov 16 '17 21:11 HarelM

I've opened a bug with repro for the non-working height issue: #8493

swftvsn avatar Nov 16 '17 22:11 swftvsn

I'm not sure this is the same. My concern is more about the UX with this dialog when the header is large and the content does not fit the screen. In this case setting max-height would not achieve what I think is a better approach that is used by bootstrap modal dialog.

HarelM avatar Nov 16 '17 22:11 HarelM

+1

ishworthapaliya avatar Nov 23 '17 18:11 ishworthapaliya

+1

amirping avatar Dec 26 '17 10:12 amirping

+1

kblicharski avatar Dec 29 '17 15:12 kblicharski