Is your feature request related to a problem? Please describe.
needed a popup option to prevent closing the popup when clicked outside
Describe the solution you'd like
When a popup option [disable clickoutside] is set, the user won't be able to close the popup outside the modal/popup. Only close button can close the popup
You can use the vs-dialog for users not being able to close dialog
I agree this functionality would be helpful. The behavior of a popup is slightly different than a dialog, so being able to manage when they can be closed provides more flexibility.
Extend the VsPopup component, add custom closeOnClickOutside prop and add condition to close method like so:
<script>
export default {
props: {
..., // others props
closeOnClickOutside: {
default: true,
type: Boolean,
},
methods: {
close(event, con) {
if (con) {
if (
event.target.className &&
event.target.className.indexOf &&
event.target.className.indexOf("vs-popup--background") != -1 &&
this.closeOnClickOutside // add this condition
) {
this.$emit("update:active", false)
this.$emit("close", false)
} else if (!this.buttonCloseHidden && event.srcElement == this.$refs.btnclose.$el) {
this.$emit("update:active", false)
this.$emit("close", false)
}
}
},
}
}
</script>
Most helpful comment
I agree this functionality would be helpful. The behavior of a popup is slightly different than a dialog, so being able to manage when they can be closed provides more flexibility.