Skip to content

Commit

Permalink
Merge pull request #14049 from rosenthalj/SelectButtonPartiallyFixed
Browse files Browse the repository at this point in the history
Enforce allowEmpty for SelectButton, fixes issue #14048
  • Loading branch information
cetincakiroglu authored Nov 8, 2023
2 parents 8aa8100 + 8914be4 commit afa0608
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/components/selectbutton/selectbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export class SelectButton implements ControlValueAccessor {
if (selected) newValue = this.value.filter((val) => !ObjectUtils.equals(val, optionValue, this.equalityKey));
else newValue = this.value ? [...this.value, optionValue] : [optionValue];
} else {
if (selected && !this.allowEmpty) {
return;
}
newValue = selected ? null : optionValue;
}

Expand Down

0 comments on commit afa0608

Please sign in to comment.