-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Prevent popper closing when document is clicked #120
Comments
Hello, you can do it by placing the |
This is an old issue, but the solution to achieve the behavior requested by @garethellis36 is the following <template>
<div>
<popper trigger="clickToOpen" :force-show="show">
<div class="popper">
<button type="button" @click="close">Close Popover</button>
</div>
</popper>
<a @click="open" slot="reference" style="cursor: pointer">
// @click required to set force-show to true
Open Popover
</a>
</div>
</template>
<script>
import Popper from 'vue-popperjs'
export default {
components: {
Popper
},
methods: {
open(){
this.show= true;
}
close() {
this.show = false;
}
},
data(){
return {
show: false
}
}
}
</script> Reviewing the source code, you can see that if vue-popper/src/component/popper.js.vue Line 392 in d076e6d
Pay attention to manage the I don't know if this project is still active, but could be useful to improve the documentation for this case. |
I'd like to put a form inside a popper which is opened when a button is clicked. That is fine and easy to achieve with
trigger="clickToOpen"
. However, whenever someone clicks outside the popper, the popper closes, which could be annoying for users. I want to control when the popper closes via a specific 'close' button and other events. Is this possible?The text was updated successfully, but these errors were encountered: