angular / angular/components

Bug(Dialog): Dialog size is fixed and can't be changed

未关闭
#29,384 7 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看
area: material/dialog P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### 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

16-

### Description

Exist a property that make all dialogs appear at the same exact size at this class:

.cdk-overlay-pane.mat-mdc-dialog-panel
max-width: var(--mat-dialog-container-max-width, 80vw);

If you replace it with this at style.scss now it works fine and resize based on your elements
.cdk-overlay-pane.mat-mdc-dialog-panel {
max-width: 100% !important;
}

### Reproduction

StackBlitz link: No link
Steps to reproduce:
1. use a dialog and try change your modal size using dialog config ex. width: '100%'

const dialogConfig: MatDialogConfig = {
hasBackdrop: true,
disableClose: true,
width: '100%'
};

At past versions it dosnt matter, resize based on your styles and structure.

### Expected Behavior

Dialog resize based on component structure

### Actual Behavior

Dialog size appear fixed and can't change base on component elements

### Environment

- Angular: 18.0.3
- CDK/Material: 18.0.3
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

贡献指南

打开贡献指南

调研方向

首先,使用 Angular Material's MatDialogConfig 的 width 设置重现该问题,并检查报告中描述的 .cdk-overlay-pane.mat-mdc-dialog-panel max-width 规则。将当前对话框尺寸行为与之前的版本进行比较;当对话框宽度能够根据配置的值和组件内容进行响应,且不需要全局的 !important 覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, css, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。