angular / angular/components

bug(Material 3 > Button): When button is last child element in mat-dialog-content it causes a vertical scrollbar to appear

Open
#29,164 3 comments 2 reactions 0 assignees View on GitHub
area: material/button P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

v17 (Material 2)

### Description

When button is last child element in mat-dialog-content it causes a vertical scrollbar to appear.

### Reproduction

StackBlitz [link](https://stackblitz.com/edit/stackblitz-starters-1giu8v?file=src%2Fapp%2Fdialog%2Fdialog.component.html)
Steps to reproduce:
1. Create Angular v18 project + add Angular material v18
2. Create a dialog component
3. In dialog component: Add a mat-button in mat-dialog-content
4. Open dialog

![Screenshot 2024-05-31 154547](https://github.com/angular/components/assets/5632697/bc64c43c-4ee1-46a6-a665-fc056a397d87)

### Expected Behavior

There should be no vertical scrollbar in the dialog

### Actual Behavior

There is a vertical scroll bar in the dialog

### Environment

- Angular: "@angular/core": "18.0.0"
- CDK/Material: "@angular/material": "18.0.0"
- Browser(s): Edge
- Operating System: Windows

Angular CLI: 18.0.0
Node: 22.2.0
Package Manager: npm 10.7.0
OS: win32 x64

Angular: 18.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, material-luxon-adapter
... platform-browser, platform-browser-dynamic, platform-server
... router

Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1800.0
@angular-devkit/build-angular 18.0.0
@angular-devkit/core 18.0.0
@angular-devkit/schematics 18.0.0
@schematics/angular 18.0.0
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.6

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and verify the scrollbar in an Angular 18 Material dialog containing a button as the last child of mat-dialog-content. Trace the dialog-content and Material button styles involved; done means the reproduced dialog has no unwanted vertical scrollbar while retaining expected scrolling for overflowing content.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.