bug(mat-form-field): mat-error not displayed when form field is in an error state.
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
#### Reproduction
The Stackllitz app (https://stackblitz.com/edit/yz1dhz-m5re6l) renders two form controls in a form group:
1. A [mat-select](https://material.angular.io/components/select/overview)
2. A [custom form field control](https://material.angular.io/guide/creating-a-custom-form-field-control) (wraps Codemirror)
Both form controls are immediately invalid because they are initailized with null and have a required validator. The error message for each form control is displayed in ``.
Steps to reproduce:
1. Select "Foo" from the `` form control to set the corresponding validator on the second form control (the custom form field).
3. The error message for the second form control is correctly displayed `{ "required": true, "message": "Must be Foo" }`.
4. Enter the value "Foo" into the second form control to move the form control to a valid state.
5. The `` is shown. All good so far :)
6. Select "Bar" from the first form control to set a different validator.
7. The second form control is in an error state and the form field is displayed with a solid red color underline.
8. `` is NOT displayed and the `` is.

#### Expected Behavior
`` is hidden and `` is displays `{ "message": "Must be Bar" }`
#### Actual Behavior
`` is hidden and `` is displays `I am a hint.`
#### Environment
- Angular: 9.1.6
- CDK/Material: 9.2.3
- Browser(s): Chrome Version 83.0.4103.116 (Official Build) (64-bit)
- Operating System (e.g. Windows, macOS, Ubuntu): ArchLinux
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par la reproduction StackBlitz liée et comparez le mat-select avec le contrôle de champ de formulaire personnalisé qui encapsule Codemirror. Suivez la façon dont mat-form-field choisit entre mat-error et mat-hint après les modifications du validateur ; c’est terminé lorsque le message d’erreur "Must be Bar" est affiché et que l’indication est masquée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- frontend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100