bug(mat-checkbox): with Signal Forms `required()`, MatCheckbox's own validator adds a duplicate `required` error that hides the schema error message
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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:
- the schema error from
required(path, { message })- has the custommessage; - a
CompatValidationError(kindrequired, nomessage) produced byMatCheckbox.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:
- Open the console
- Click the 'Show errors' button. The first
getError('required)log showskind: requiredandmessage: undefined. The seconderrors()log shows 2 errors.
As the result nothing is rendered
Expected Behavior
- The field has a single
requirederror, the one from the schema.
Actual Behavior
errors()contains tworequirederrors: first aCompatValidationErrorfromMatCheckbox.validate()(messageisundefined), then the schema error.getError('required')returns the first one, sogetError('required')?.messageisundefinedand 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
- Linguagem predominante
- TypeScript
- Estrelas
- 25k
- Forks
- 6.8k
- Merge médio
- 1d 4h
- PRs com merge (30d)
- 69
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de angular/components
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.Talvez já em andamento @lekhmanrus assumiu há 10 dias. Abertaarea: material/sort P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
angular/components#33933 ·
Mantenedores costumam responder em até 1 dia
-
bug(mat-date-picker): month shown twice in date pickerTalvez já em andamento @PreethiPantangi assumiu há 27 dias. Abertaarea: material/datepicker P4
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
angular/components#33763 · 2 comentários · 3 reações ·
Mantenedores costumam responder em até 1 dia
-
Bug in table.scss footer cell height: unset instead of footer row height unsetTalvez já em andamento @minwookshin assumiu há 14 dias. Abertaarea: material/table P4
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
angular/components#33709 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
docs-bug(Table): Add example with `rowspan`Talvez já em andamento @BHUVANSH855 assumiu há 94 dias. Abertaarea: material/table docs P4
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
angular/components#33455 ·
Mantenedores costumam responder em até 1 dia
-
bug(date-adapter): Misleading JSDoc for createDate returns typeTalvez já em andamento @BHUVANSH855 assumiu há 144 dias. Abertaarea: material/core P3
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
angular/components#33059 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de angular/components
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
chrisparsons83/flexspotff#215 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
vitest-dev/vitest#11633 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia