From b9d8cb9925a9a09a14b372ac743ce9669cf0f9a9 Mon Sep 17 00:00:00 2001 From: Brandy Smith <6577830+brandyscarney@users.noreply.github.com> Date: Fri, 28 Feb 2025 16:01:00 -0500 Subject: [PATCH] fix(angular): mark radio group as touched when radio is blurred --- .../directives/control-value-accessors/value-accessor.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/angular/common/src/directives/control-value-accessors/value-accessor.ts b/packages/angular/common/src/directives/control-value-accessors/value-accessor.ts index 9c4dc7444b..9e556b9b7e 100644 --- a/packages/angular/common/src/directives/control-value-accessors/value-accessor.ts +++ b/packages/angular/common/src/directives/control-value-accessors/value-accessor.ts @@ -52,6 +52,13 @@ export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDes if (el === this.elementRef.nativeElement) { this.onTouched(); setIonicClasses(this.elementRef); + + // When ion-radio is blurred, el and this.elementRef.nativeElement are + // different so we need to check if the closest ion-radio-group is the same + // as this.elementRef.nativeElement and if so, we need to mark the radio group + // as touched + } else if (el.closest('ion-radio-group') === this.elementRef.nativeElement) { + this.onTouched(); } }