Skip to content

Commit

Permalink
fix(kit): CheckboxLabeled/RadioLabeled fix changing in readonly mode
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandr Shakirov <al.a.shakirov@tinkoff.ru>
  • Loading branch information
afferenslucem and Alexandr Shakirov authored Oct 10, 2024
1 parent f6d49c1 commit bd6d1e2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export class TuiCheckboxLabeledComponent
this.updateFocused(focused);
}

stopReadonlyChanging(event: Event): void {
if (this.readOnly) {
event.preventDefault();
}
}

/** @deprecated use 'value' setter */
onModelChange(value: boolean): void {
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<label class="t-wrapper">
<label
class="t-wrapper"
(click)="stopReadonlyChanging($event)"
>
<tui-checkbox
[disabled]="computedDisabled"
[focusable]="focusable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export class TuiRadioLabeledComponent<T>
return this.disabled || this.pseudoDisabled;
}

stopReadonlyChanging(event: Event): void {
if (this.readOnly) {
event.preventDefault();
}
}

onFocused(focused: boolean): void {
this.updateFocused(focused);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<label class="t-wrapper">
<label
class="t-wrapper"
(click)="stopReadonlyChanging($event)"
>
<tui-radio
[focusable]="focusable"
[identityMatcher]="identityMatcher"
Expand Down

0 comments on commit bd6d1e2

Please sign in to comment.