Skip to content

Commit b9d8cb9

Browse files
committed
fix(angular): mark radio group as touched when radio is blurred
1 parent ef31de3 commit b9d8cb9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/angular/common/src/directives/control-value-accessors/value-accessor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDes
5252
if (el === this.elementRef.nativeElement) {
5353
this.onTouched();
5454
setIonicClasses(this.elementRef);
55+
56+
// When ion-radio is blurred, el and this.elementRef.nativeElement are
57+
// different so we need to check if the closest ion-radio-group is the same
58+
// as this.elementRef.nativeElement and if so, we need to mark the radio group
59+
// as touched
60+
} else if (el.closest('ion-radio-group') === this.elementRef.nativeElement) {
61+
this.onTouched();
5562
}
5663
}
5764

0 commit comments

Comments
 (0)