Skip to content

fix(material/form-field): enhance error handling for multiple form field controls #30909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

mistrykaran91
Copy link
Contributor

Currently, when multiple mat form fields are used together, the error is taken for the first control only, this take into consideration other controls too if they exist

Fixes #28887

@mistrykaran91 mistrykaran91 requested a review from a team as a code owner April 21, 2025 10:05
@mistrykaran91 mistrykaran91 requested review from adolgachev and crisbeto and removed request for a team April 21, 2025 10:05
…eld controls

Currently, when multiple mat form fields are used together, the error is taken for the first control only, this take into consideration other controls too if they exist

Fixes angular#28887
@mistrykaran91 mistrykaran91 force-pushed the fix/mat-error-not-shown-when-multiple-controls-in-form-fields branch from 5dbceb0 to c4f6921 Compare April 21, 2025 10:06
@mistrykaran91 mistrykaran91 changed the title fix(form-field): enhance error handling for multiple form field controls fix(material/form-field): enhance error handling for multiple form field controls Apr 21, 2025
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form field isn't meant to have more than one control.

@mistrykaran91
Copy link
Contributor Author

The form field isn't meant to have more than one control.

Normally, we have matInput and mat-chip-grid or mat-autocomplete and mat-chip-grid together so won't that be considered as more than one control ? Or is this issue not valid ?

@crisbeto
Copy link
Member

matInput isn't really necessary for mat-chip-grid. As for the autocomplete scenario, it has always been a bit under-developed since what ends up happening is that the form field takes whichever control was defined first. Either way, we shouldn't try to account for multiple controls, because then it becomes tricky to reconcile things like the current label and value.

@mistrykaran91
Copy link
Contributor Author

mistrykaran91 commented Apr 21, 2025

matInput isn't really necessary for mat-chip-grid. As for the autocomplete scenario, it has always been a bit under-developed since what ends up happening is that the form field takes whichever control was defined first. Either way, we shouldn't try to account for multiple controls, because then it becomes tricky to reconcile things like the current label and value.

Ok got you, then I think we should close or reject the current issue which associated with it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(MatAutocomplete): Errors not displaying
2 participants