Skip to content

Dialog with fixed height less than 100% has 2 scrollbars #6584

Open

Description

@tytskyi

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.

Activity

  1. julianobrasil commented on Aug 22, 2017

    @julianobrasil
    Contributor

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

    image

  2. tytskyi commented on Aug 22, 2017

    @tytskyi
    Author

    @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
  3. julianobrasil commented on Aug 22, 2017

    @julianobrasil
    Contributor

    It happened with the browser shrinked.

  4. added
    P3
    on Sep 27, 2017
  5. added a commit that references this issue on Jan 4, 2018
    83da015
  6. added 2 commits that reference this issue on Jan 4, 2018
    8ee04db
    214f719
  7. added a commit that references this issue on Jan 12, 2018
    fb4dbf0
  8. added a commit that references this issue on Jan 21, 2018
    fd16286
  9. added a commit that references this issue on Jan 24, 2018
    67ab3e9
  10. surachaitanya commented on Feb 6, 2018

    @surachaitanya

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

  11. added a commit that references this issue on Mar 2, 2018
    2a31c21
  12. added a commit that references this issue on Mar 30, 2018
    2c65285
  13. 8 remaining items

  14. added a commit that references this issue on Nov 24, 2018
    c7905ae
  15. added a commit that references this issue on Mar 1, 2019
    cc3ba6f
  16. added a commit that references this issue on Mar 30, 2019
    dccfb41
  17. mergin commented on May 7, 2019

    @mergin

    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

  18. mycroft16 commented on Jun 7, 2019

    @mycroft16

    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.

  19. tommueller commented on May 5, 2020

    @tommueller

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

  20. Laurensvdw commented on Mar 12, 2021

    @Laurensvdw

    @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!

  21. brandart commented on Feb 10, 2022

    @brandart

    this is very annoying. is there any way around?

  22. RueDeRennes commented on Apr 15, 2022

    @RueDeRennes

    is there now a fix?

  23. nikhil-clearcals commented on Apr 30, 2022

    @nikhil-clearcals

    Is this bug fixed by any chance ?

  24. uncleGera commented on May 4, 2022

    @uncleGera

    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

  25. masum7 commented on Apr 6, 2023

    @masum7

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: material/dialog

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions