primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.5k stars 1.23k forks source link

SelectButton: the multiple and allowempty combo should make it possible to deselect values as long as at least 1 remains. #4731

Open oliviermattei opened 1 year ago

oliviermattei commented 1 year ago

Describe the bug

Currently, with allowEmpty = false, if an option is selected, it cannot be deselected.

The allowEmpty property seems to imply that the component must not have an empty value, i.e. at least 1 option must be selected.

This would allow the user to correct his selection if he makes a mistake, without having to refresh the page.

Reproducer

https://stackblitz.com/edit/ea9fy2?file=src%2FApp.vue

PrimeVue version

3.38.1

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

SelectButton with 3 options: (X => selected, 0 => unselected)

1: 0 0 0 2: 0 X 0 (X not deselectable) 3: X X 0 (both X not deselectable) 4: X X X (all X not deselectable)

Expected behavior

SelectButton with 3 options: (X => selected, 0 => unselected)

1: 0 0 0 2: 0 X 0 (X not deselectable) 3: X X 0 (one of the two X is deselectable) 4: X 0 0 (X not deselectable) 5: X X X (two X is deselectable)

oliviermattei commented 1 year ago

Is there any documentation to fork and install primevue locally?

After installing the packages and nuxt dev, I'm getting errors and must have missed a step.

FlipWarthog commented 1 year ago

Is there any documentation to fork and install primevue locally?

After installing the packages and nuxt dev, I'm getting errors and must have missed a step.

Can you start a discussion for this here: https://github.com/orgs/primefaces/discussions ? I've got it working locally so I might be able to help if you can include the errors you're getting.

nicoroy2561 commented 11 months ago

I am encountering this issue as well. Definitely not expected.

SamuelWei commented 8 months ago

I was also very surprised that if multiple and allowEmpty are both true, you can only select more items but never deselect them. My expectation would be that you have to select at least one item.