Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#33,945 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
angular, typescript
Área
frontend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 5 h
PR fusionados (30 d)
67

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de angular/components

Todos los issues de angular/components

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.