Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug(form-field): notch width is out of sync with custom label content during layout changes

Đang mở
#33,207 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

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

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được cung cấp trong src/main.ts và kiểm tra hành vi đường viền của mat-form-field khi thay đổi kích thước container. So sánh nội dung mat-label nổi với phần notch trong quá trình thay đổi layout. Hoàn tất khi notch theo sát chiều rộng của label một cách đồng bộ mà không bị trượt, lệch hoặc chồng lấp rõ ràng.

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

Mô tả

area: material/form-field P4
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

The MDC-based mat-form-field (outline appearance) fails to synchronously update the notch (gap) width when the content inside mat-label changes its layout or when the container is resized. This is especially evident when using custom components with Flexbox inside the label (e.g., for adding help icons or tooltips).

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-gnupffhv?file=src%2Fmain.ts
Steps to reproduce:

  1. Create a mat-form-field with appearance="outline" and floatLabel="always".
  2. Apply display: flex to the mat-label (or a container immediately inside it).
  3. Place a text string and an icon (e.g., mat-icon) inside that flex container.
  4. Dynamically change the width of the form field's container (e.g., by resizing the browser window or using a slider in the provided reproduction).
  5. Observe the behavior of the label content and the notch gap.
Expected Behavior

The notch gap should resize synchronously with the label content to prevent any "sliding" or "drifting" effect. The gap in the outline should always match the actual width of the floating label in real-time during container resizing or layout shifts, ensuring that the border never overlaps the label's text or icons.

Actual Behavior

There is a significant visual lag in the label's positioning and scaling. While the browser's layout engine expands the container instantly, the label's text content moves and resizes with a delay.

In this implementation, we intentionally prioritize the visibility of the tooltip/icon over the label text.. This ensures that the help trigger is always accessible to the user, even on small screens

Lag Animation: https://github.com/user-attachments/assets/a3e9ff59-8586-449b-95d1-d5d0b3e0f727

Environment
  • Angular: 21.2.10
  • CDK/Material: 21.2.8
  • Browser(s): Chrome 147.0.7727.138
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
84

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/components

Tất cả issue của angular/components

Issue tương tự

Thêm issue về TypeScript

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.