angular / angular/components

bug(radio-group): form scope is not respecated

Offen
#27,817 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/radio P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Other than with vanilla radio buttons with angular material radio groups the form is not used as a scope. Radios groups with the same name interfere with each other even if in different forms. This makes it very hard to use them in template driven forms when wanting to pull the data from the NgForm value.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/vaq4dq?file=src%2Fexample%2Fradio-overview-example.html
Steps to reproduce:
1.
2.

### Expected Behavior

The form element is used as a scope for radio-groups

### Actual Behavior

Radio groups from all forms are connected by name

### Environment

OS: linux x64

Angular: 16.1.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version
------------------------------------------------------------
@angular-devkit/architect 0.1601.0
@angular-devkit/build-angular 16.1.0
@angular-devkit/core 16.1.0
@angular-devkit/schematics 16.1.0
@angular/cdk 16.2.4
@angular/cli 16.1.0
@angular/material 16.2.4
@angular/material-moment-adapter 16.2.4
@schematics/angular 16.1.0
rxjs 7.4.0
typescript 5.0.3

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the StackBlitz reproduction at src/example/radio-overview-example.html and confirm that same-named radio groups interfere across separate forms. Trace the Angular Material radio-group behavior responsible for grouping, then add coverage showing form-scoped groups remain independent and verify the reproduction no longer occurs.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
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.