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(MatFormFieldControl, MatInput): enable empty value for element attributes

Đang mở
#33,353 1 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
56/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 trên StackBlitz và kiểm tra các khai báo TypeScript cho MatInput cùng các triển khai MatFormFieldControl được nêu trong issue. Xác nhận hành vi đối với placeholder trống, maxlength, required và các thuộc tính liên quan, sau đó thêm hoặc cập nhật phạm vi kiểm thử để null và undefined được chấp nhận nhất quán.

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

Mô tả

area: many gemini-triaged 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

21

Description

Recent TypeScript 6 flashes out discrepancies in attributes declaration for html/material controls.

For MatInput, as for other controls, TypeScript doesn't allow empty (null or undefined) values.

The required, placeholder, etc. forces strict datatype while others such as autocomplete are optional.

Previous Angluar version 21 handled these cases correct, for example, placeholder in MatFormField.

In my view, all MatFormFieldControl attributes should be optional, to reflect HTML tag design by definition.

It's common to forward optional attributes between components that holds undefined value; forcing an issue when refering to HTML tag such as input with Angular decoration.

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-ffzyyuuu?file=src%2Fmain.ts
Steps to reproduce:
See errors for empty placehoder and missing maxlength.

Expected Behavior

Attributes such as placeholder should accept null and undefined.

This should be common among all MatFormFieldControl implementations.

Actual Behavior

Common attributes doesn't allow empty values.

Environment

Angular CLI : 22.0.0
Angular : 22.0.0
Node.js : 24.16.0
Package Manager : npm 11.16.0
Operating System : win32 x64

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.