components icon indicating copy to clipboard operation
components copied to clipboard

bug(mat-dialog): mat-dialog-content always has a scroll bar when there is a element with ripple overflowing inside

Open Ploppy3 opened this issue 6 years ago • 10 comments

Reproduction

Steps to reproduce: put a mat-slide-toggle in a mat-dialog-content

https://stackblitz.com/edit/angular-pt8j22?file=src/app/dialog-content-example-dialog.html

EDIT: same goes for checkboxes

Expected Behavior

there should not be a scroll bar when having a mat-slide-toggle in a mat-dialog-content if the content does not exceed the max height allowed

Actual Behavior

mat-dialog-content always has a scroll bar when there is a mat-slide-toggle inside it

Environment

  • Angular: 10
  • CDK/Material: 10
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Ploppy3 avatar Aug 17 '20 14:08 Ploppy3

Hi, this is caused by .mat-slide-toggle .mat-slide-toggle-ripple that has 40px height, which is larger than the mat-slide-toggle's 24px. We overcome this problem by applying padding top/bottom to a the toggle, when it's first/last.

Totati avatar Aug 18 '20 09:08 Totati

@Totati Thank you for the workaround, I could not find the solution, much appreciated.

Ploppy3 avatar Aug 18 '20 12:08 Ploppy3

Looks like this will be a problem with the MDC slide toggle too. It may be tricky to get a fix merged in, because it can cause screenshot diff failures.

crisbeto avatar Aug 23 '20 08:08 crisbeto

Just wanted to add that I ran into this issue with radio buttons as well, when they are at the bottom of the dialog content.

nienow avatar Jan 07 '21 17:01 nienow

@nienow Yes, it happens because radio buttons also have ripples.

Ploppy3 avatar Jan 07 '21 21:01 Ploppy3

Any update on this? This has been an annoyance for a long time. Would be nice to get it fixed.

kyletanders avatar Aug 23 '21 17:08 kyletanders

Angular material 15: this solved the issue // to fix the issue with the dialog scroll issue .mdc-dialog__surface { overflow-y: hidden !important; }

mpeguero avatar Feb 26 '23 21:02 mpeguero

Its weird and unusable behavior

roma2341 avatar Nov 28 '24 19:11 roma2341

Similar to mat-checkbox. Workaround Material 3:

  mat-checkbox {
    --mat-checkbox-touch-target-display: none;
  }

DywiTom avatar Apr 29 '25 14:04 DywiTom

So nearly 6 years now, and nothing has changed :(

carl-sauter avatar Mar 13 '26 07:03 carl-sauter