angular / angular/components

troubleshooting(dialog): Dialog title :before psuedo element

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

描述

### Is this a regression?

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

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

_No response_

### Description

We are doing a migration to Material Angular 16 and when attempting to style the `mat-dialog-title` of a dialog. There is a `:before` pseudo element which has an empty string as content, and I believe the purpose of this element is to set the height of the title element with the `mat-dialog-title` directive. Is this correct? This implementation seems very hacky to me and flexbox `justify-content` does not work property because this pseudo element is considered an element within a flex container, and therefore the developer either needs to create a new flex container within the `mat-dialog-title` or remove the content from the `:before` psuedo element. Am I not not thinking of this correctly and is there another way to use `justify-content` which works with this psuedo element?

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

If the `mat-dialog-title` container is a flex container, `justify-content: space-between` works correctly.

### Actual Behavior

`justify-content: space-between` adds space between the psuedo element which has an empty string as content and the next element within the `mat-dialog-title`

### Environment

- Angular: 16.2.10
- CDK/Material: 16.2.9
- Browser(s): Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): macOS

贡献指南

打开贡献指南

调研方向

从与 mat-dialog-title 指令关联的 Angular Material 对话框标题样式开始,使用 issue 中的 flexbox 示例在 Firefox 中复现该布局。检查 :before 伪元素如何影响 justify-content: space-between。当对话框标题的 flex 布局能够按预期运行,且不需要额外的容器或手动移除伪元素时,即视为完成。

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

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

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