SelectButton: Cannot deselect any buttons when allowEmpty=false and multiple=true #17576
Open
1 of 4 tasks
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
When allowEmpty=false and multiple=true the buttons of a ButtonSelect component cannot be deselected at all. In PrimeNG versions prior to v18 the option allowEmpty=false only made sure that at least one button had to be selected. You could deselect buttons as usual as long as at least one button was still selected.
Pull Request Link
No response
Reason for not contributing a PR
Other Reason
I'm not sure how to fix this.
The input allowEmpty is simply passed to all ToggleButton components, which seems wrong and undesired for multi-selection. Maybe it should be
[allowEmpty]="allowEmpty || multiple"
?Reproducer
https://stackblitz.com/edit/github-eps8r4ln-z8wgvjvj?file=src%2Fapp%2Fapp.component.html
Environment
See Stackblitz.
The issue occurs with PrimeNG 18 and Angular 18.2 as well as with PrimeNG 19 and Angular 19.1. I have provided a Stackblitz for PrimeNG 19 and Angular 19.1.
Angular version
19.1.5
PrimeNG version
v19
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
The component should behave like in PrimeNG 17 and before. allowEmpty should only prevent that all buttons are deselected. It should be possible to deselect buttons as long as at least one button is selected.
The text was updated successfully, but these errors were encountered: