Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

bug(mat-checkbox): with Signal Forms `required()`, MatCheckbox's own validator adds a duplicate `required` error that hides the schema error message

Offen
#33,945 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
angular, typescript
Bereich
frontend, testing

Rechercherichtung

Start by tracing how Signal Forms errors are combined with the MatCheckbox validator; the issue names MatCheckbox.validate() and CompatValidationError but does not identify source files or tests. Reproduce with the linked StackBlitz and inspect the error output. Done means the field exposes only the schema’s required error, including its custom message.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area: material/checkbox P3
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

No response

Description

When a mat-checkbox is bound to a Signal Forms field with [formField] and the schema uses required(), the field ends up with two errors of kind required:

  1. the schema error from required(path, { message }) - has the custom message;
  2. a CompatValidationError (kind required, no message) produced by MatCheckbox.validate().

This happens with many components which have 'required' input and validate method from Validators interface.

Reproduction

StackBlitz link: https://stackblitz.com/edit/1sinlau9-qd7bhr37?file=src%2Fexample%2Fcheckbox-signal-forms-example.ts
Steps to reproduce:

  1. Open the console
  2. Click the 'Show errors' button. The first getError('required) log shows kind: required and message: undefined. The second errors() log shows 2 errors.

As the result nothing is rendered

Expected Behavior
  • The field has a single required error, the one from the schema.
Actual Behavior
  • errors() contains two required errors: first a CompatValidationError from MatCheckbox.validate() (message is undefined), then the schema error.
  • getError('required') returns the first one, so getError('required')?.message is undefined and nothing is rendered.
Environment
  • Angular: 22.0.6
  • CDK/Material: 22.0.4
  • Browser(s): Google Chrome Version 154.0.8037.98
  • Operating System: MacOs 27.0
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 4 Std.
Gemergte PRs (30 T.)
69

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus angular/components

Alle Issues in angular/components

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

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