Skip to content

Commit

Permalink
fix(radio-group): FormControl disabled doesn't work (#13275)
Browse files Browse the repository at this point in the history
Closes #13236

The disabled option of FormControl does nothing for individual radio
buttons when used on a radio group.
  • Loading branch information
simeonoff authored Jul 18, 2023
1 parent 47b94e2 commit 2365194
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
this.queryChange$.next();
setTimeout(() => this._initRadioButtons());
});


if (this.ngControl) {
this.radioButtons.forEach((button) => {
if (this.ngControl.disabled) {
button.disabled = this.ngControl.disabled;
}
});
}
}

/**
Expand All @@ -359,16 +368,16 @@ export class IgxRadioGroupDirective implements AfterContentInit, AfterViewInit,
if (this.radioButtons) {
this.radioButtons.forEach((button) => {
button.blurRadio
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
this.updateValidityOnBlur()
});
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
this.updateValidityOnBlur()
});

fromEvent(button.nativeElement, 'keyup')
.pipe(takeUntil(this.destroy$))
.subscribe((event: KeyboardEvent) => {
this.updateOnKeyUp(event)
});
.pipe(takeUntil(this.destroy$))
.subscribe((event: KeyboardEvent) => {
this.updateOnKeyUp(event)
});
});
}
}
Expand Down

0 comments on commit 2365194

Please sign in to comment.