Fix: Add preventDefault on SplitButton click event

The SplitButton component of PrimeVue was missing a preventDefault()
call when clicking on the button that opens the dropdown menu. This
caused unexpected behavior when interacting with the dropdown menu.
The issue has been resolved by adding the preventDefault() on the click
event, ensuring smooth and expected functionality.

Fixes #4223"
pull/4224/head
François Volral 2023-07-31 14:54:09 +02:00
parent f37a0a783e
commit 8ef984894d
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,8 @@ export default {
}); });
}, },
methods: { methods: {
onDropdownButtonClick() { onDropdownButtonClick(event) {
event.preventDefault();
this.$refs.menu.toggle({ currentTarget: this.$el, relatedTarget: this.$refs.button.$el }); this.$refs.menu.toggle({ currentTarget: this.$el, relatedTarget: this.$refs.button.$el });
this.isExpanded = this.$refs.menu.visible; this.isExpanded = this.$refs.menu.visible;
}, },
@ -67,6 +68,8 @@ export default {
} }
}, },
onDefaultButtonClick(event) { onDefaultButtonClick(event) {
event.preventDefault()
if (this.isExpanded) { if (this.isExpanded) {
this.$refs.menu.hide(event); this.$refs.menu.hide(event);
} }