angular / angular/components

mat-form-field required fields that are disabled should have the option to show the asterisk

Ouverte
#10,270 6 commentaires 12 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

area: material/form-field feature P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

Bug, feature request, or proposal:

Proposal

What is the expected behavior?

For a control that is required and disabled the asterisk has the option to be shown.

What is the current behavior?

When a control is disabled the asterisk is removed, even when marked as required. This will show a form as requiring less fields to be populated than actually is required.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

https://stackblitz.com/edit/angular-material2-issue-sezut1?file=app/app.component.ts

What is the use-case or motivation for changing an existing behavior?

We have a form that requires you to choose a hierarchy location first - which will then go off and get related data. The selects are required but disabled to start with because they can't be interacted with until the hierarchy location is selected. Once hierarchy location is selected, selects get populated and become enabled.

The issue here is the drip-feeding, the user will be shown X controls on load that are required - as the user is actively filling in the form they will be told more controls are required. So the initial X controls that were required is now incorrect and now more controls are required to be populated.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.2.2. Material 5.1.0

Is there anything else we should know?

I found where this change was done, in request to robmv's proposal (https://github.com/angular/material2/issues/8251). I believe there is a valid use-case where asterisk's should not be shown, but in our use-case we need to show the asterisk even when disabled.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le comportement de mat-form-field reproduit dans le StackBlitz lié, en particulier app/app.component.ts, et examinez comment un contrôle désactivé obligatoire est représenté. Déterminez comment exposer une option permettant de conserver l’astérisque tout en préservant le comportement existant par défaut. La tâche est terminée lorsque la reproduction affiche le marqueur obligatoire pour les contrôles désactivés lorsque cette option est activé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
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.