angular / angular/components

bug(Dialog, Form Field): The form field outline appearance label is cut of when it's the first element in a dialog

Đang mở
#26,352 12 bình luận 10 reaction 0 người được giao Xem trên GitHub
area: material/dialog area: material/form-field P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

_No response_

### Description

I'm not sure if this is a regression as we used the legacy style form fields before we updated to Angular (material) v15

When placing a form field with appearance="outline" as the first element in a dialog I get the following result:
![image](https://user-images.githubusercontent.com/40668465/210241509-5e6783b6-3063-456b-b3fc-be7b1f757a91.png)

I'm using the mat-dialog-title and mat-dialog-content directives which will set the top padding of the content part to 0px
![image](https://user-images.githubusercontent.com/40668465/210242034-68ab4fa8-964c-49eb-86db-73c137dc7d2b.png)

A simple workaround is to set a top padding of 5px, but this should work out of the box.

### Reproduction

Steps to reproduce:
1. Open the following [Stackblitz](https://stackblitz.com/edit/angular-rq3u2y?file=src%2Fapp%2Fdialog-overview-example-dialog.html) .
2. Click the Pick one button to open the dialog.
3. The dialog should focus the input and this shows the image.
4. Optional enter a value in the input field

### Expected Behavior

I would expect to be able to see the full label when a form field is the first element in a dialog.

### Actual Behavior

The top part of the label is cut off.

### Environment

Angular CLI: 15.0.3
Node: 16.13.1
Package Manager: npm 8.1.3
OS: win32 x64

Angular: 15.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package Version
------------------------------------------------------------
@angular-devkit/architect 0.1500.3
@angular-devkit/build-angular 15.0.3
@angular-devkit/core 15.0.3
@angular-devkit/schematics 15.0.3
@angular/cdk 15.0.2
@angular/flex-layout 14.0.0-beta.41
@angular/material 15.0.2
@angular/material-moment-adapter 15.0.2
@schematics/angular 15.0.3
rxjs 7.6.0
typescript 4.8.4

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và hành vi dialog/form-field của Angular Material liên quan đến mat-dialog-title, mat-dialog-content và appearance="outline". Xác nhận hiện tượng bị cắt khi field được focus với tư cách là phần tử đầu tiên của dialog, sau đó tìm implementation liên quan và regression test. Hoàn tất khi toàn bộ label hiển thị mà không cần workaround padding 5px và hành vi này được một test bao phủ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.