-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Multiselect: Menu closes on select #4861
Comments
You don't need to add to much options, just need to scroll and select then the problem can reproduce.
|
This problem is caused by bindOutsideClickListener() {
if (!this.outsideClickListener) {
this.outsideClickListener = (event) => {
if (this.overlayVisible && this.isOutsideClicked(event)) {
this.hide();
}
};
document.addEventListener('click', this.outsideClickListener);
}
}
isOutsideClicked(event) {
return !(this.$el.isSameNode(event.target) || this.$el.contains(event.target) || (this.overlay && this.overlay.contains(event.target)));
} The function |
Simple reproducer: https://stackblitz.com/edit/hmwkta?file=src/App.vue,package.json
|
I’ve tested #4864 and this pr should fix this issue. |
Cannot replicate issue with the latest version. How can replicate the issue? |
@tugcekucukoglu Thank you for looking into the issue. The issue is still reproducible with V4: https://stackblitz.com/edit/ivkrzp?file=src%2FApp.vue |
You could try to add a theme and if you prefer unstyled mode, |
Describe the bug
I want to display the selected options at the top of the list.
I therefore sort the selected options to the top.
If I now click on something further down in the menu, it is automatically sorted to the top.
At the same time, the menu closes by mistake. The menu should remain open.
Cause of the error:
Since I use the virtualscroller, not all options are rendered in the html.
Therefore the outsideClickListener does not find the clicked option and thinks it was a click outside the menu.
The menu is then incorrectly closed.
Reproducer
https://stackblitz.com/edit/lictaz?file=src%2FApp.vue
PrimeVue version
3.41.0
Vue version
3.x
Language
ES6
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
Open Menu
Scroll Down
Select an option
=> Menu will close
Expected behavior
Menu should stay open as long as I dont click outside.
The text was updated successfully, but these errors were encountered: