vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

Prevent menu deactivation from generating further click events

Open emrdev opened this issue 9 years ago • 7 comments

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

emrdev avatar Aug 20 '17 20:08 emrdev

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?

johnleider avatar Aug 21 '17 12:08 johnleider

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.

nekosaur avatar Aug 21 '17 13:08 nekosaur

I see. If that's the case, I do not agree. Could you clarify @emrdev ?

johnleider avatar Aug 21 '17 13:08 johnleider

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.

emrdev avatar Aug 21 '17 13:08 emrdev

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!

johnleider avatar Aug 21 '17 13:08 johnleider

I just tried the same test on other sites and apps and the behavior is generally as @nekosaur describes, so.. happy to close.

emrdev avatar Aug 21 '17 13:08 emrdev

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

lock[bot] avatar Apr 16 '19 04:04 lock[bot]