angular / angular/components

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

Offen
#10,270 6 Kommentare 12 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/form-field feature P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

#### 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem im verknüpften StackBlitz reproduzierten Verhalten von mat-form-field, insbesondere mit app/app.component.ts, und untersuche, wie ein erforderliches deaktiviertes Steuerelement dargestellt wird. Ermittle, wie eine Option zum Beibehalten des Sternchens verfügbar gemacht werden sollte, wobei das bestehende Verhalten standardmäßig erhalten bleibt. Als abgeschlossen gilt die Aufgabe, wenn die Reproduktion den erforderlichen Marker für deaktivierte Steuerelemente anzeigt, sobald diese Option aktiviert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.