-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SelectButton: allowEmpty does not stop unselecting #6718
Comments
I have looked into the issue and checked the version of PrimeVue mentioned in the problem. @cmcnicholas You specified the version in the package.json with "^", this does not set the version to a specific version but allows for all newer minor versions according to SemVer. |
I'm using 4.2.2 and still experiencing the issue. |
I’m still encountering this issue in version 4.2.3. As a temporary workaround, I reset the value once it’s unselected: watch(
value,
(newValue, oldValue) =>
newValue === null && setTimeout(() => (value.value = oldValue), 0)
); Here’s a StackBlitz example. While this approach is far from ideal, it gets the job done until the issue is resolved. |
Did some poking at source code and found the issue. // ToggleButton.vue
onChange(event) {
if (!this.disabled && !this.readonly) {
this.writeValue(!this.d_value, event);
this.$emit('change', event);
}
}, The internal state of the button gets set to false and is causing the 'selected' status to be removed, however the actual model-value of the SelectButton doesnt get updates since it gets blocked. Not sure best approach on how to resolve this without using a prop thats basically a So luckily its just a visual bug, but still annoying |
@Winter979 My approach to fixing this issue was to override the Another approach I tried, which worked as well, involved adding a So I'm not quite sure how to resolve this issue if the maintainers don't like the way I overrode the |
This option works in 4.0.0 version, but not in 4.2.1 |
Describe the bug
When using the
SelectButton
and:allow-empty="false"
a user can still deselect the currently selected item by clicking it again.Reproducer
https://stackblitz.com/edit/primevue-4-vite-issue-template-htijut?file=src%2FApp.vue
PrimeVue version
4.0.4
Vue version
4.x
Language
TypeScript
Build / Runtime
Vue CLI App
Browser(s)
Chrome
Steps to reproduce the behavior
:allow-empty="false"
onSelectButton
Expected behavior
:allow-empty="false"
should restrict the user from deselectingThe text was updated successfully, but these errors were encountered: