Prevent menu deactivation from generating further click events
Steps to reproduce
Create a menu with a button activator, create another element on the page that receives click events.
Versions
"vue": "2.4.2",
"vue-router": "2.7.0",
"vuetify": "0.14.11",
What is expected ?
The menu is dismissed when clicking outside its activator element, and no further click event is propagated.
What is actually happening ?
The 2nd button (not linked to the menu) can be clicked when the menu is visible, deactivating the menu but also receiving a click event of its own. Would be preferable that if the menu is already visible that the 1st click anywhere else closes the menu only.
Reproduction Link
https://codepen.io/anon/pen/rzdzJX
I'm not really understanding this. If you don't want a click event to the second button, why not add .stop to your click binding?
That won't work, that will stop the menu from closing.
However, I do not agree that a click anywhere else should only close the menu. Menus are not dialogs/modals. They are not a separate interactive elements, but part of the page you are currently on.
I see. If that's the case, I do not agree. Could you clarify @emrdev ?
My example isn't great, but say for example the dropdown appears within a table and each table row has a click handler to toggle whether the row is selected or not. When the dropdown appears, clicking outside the dropdown to dismiss the menu will select a table row unintentionally, if there is one under the cursor.
I guess the behavior I'd prefer from the dropdown would be more like dismissing a modal when clicking the scrim.
Can you update the codepen to represent the example described above? It would go a long way in determining the best course of action, thank you!
I just tried the same test on other sites and apps and the behavior is generally as @nekosaur describes, so.. happy to close.