Skip to content

Commit

Permalink
fix(radio.tsx, checkbox.tsx): fixes checked value change to reflect i…
Browse files Browse the repository at this point in the history
…n UI when disabled

This fixes the UI to show the correct value of checked when the property changes.

fix #154
  • Loading branch information
Asif Ahmed committed Mar 16, 2021
1 parent 131df05 commit 0cc6f70
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export class Checkbox {
@Watch('checked')
checkChanged(isChecked: boolean) {
if (!this.disabled) {
this.checkbox.checked = isChecked;
this.fwChange.emit({
value: this.value,
checked: isChecked,
});
}
this.checkbox.checked = isChecked;
}

@Watch('disabled')
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio-group/radio-group.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Meta, Story, Preview, Props } from '@storybook/addon-docs/blocks';
### Default
<Preview>
<Story name='Default'>{() => `
<fw-radio-group>
<fw-radio-group value="no">
<fw-radio value="yes">Yes</fw-radio>
<fw-radio value="no">No</fw-radio>
<fw-radio value="maybe">Maybe</fw-radio>
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class Radio {
@Watch('checked')
checkChanged(isChecked: boolean) {
if (!this.disabled) {
this.radio.checked = isChecked;
if (isChecked) {
this.fwSelect.emit({
value: this.value,
Expand All @@ -66,6 +65,7 @@ export class Radio {
this.fwDeselect.emit();
}
}
this.radio.checked = isChecked;
}

@Watch('disabled')
Expand Down

0 comments on commit 0cc6f70

Please sign in to comment.