ipyvue icon indicating copy to clipboard operation
ipyvue copied to clipboard

feat: allow frontend code in events

Open mariobuikhuizen opened this issue 1 year ago • 2 comments

Making the following possible:

import ipyvuetify as v

activator = v.Sheet(style_="width: 500px; height: 500px", elevation=8)
activator.on_event("contextmenu.prevent", "menu.on.click")

v.Sheet(children=[
    v.Menu(
        v_slots=[
            {
                "name": "activator",
                "variable": "menu",
                "children": [activator],
            }
        ],
        absolute=True,
        children=[
            v.Btn(children=["hi"])
        ],
        
    ),
])

One thing I noticed though, is that we need an extra right-click to show the menu on a different spot. So it might not be useful for the original envisioned use-case.

mariobuikhuizen avatar Sep 18 '23 14:09 mariobuikhuizen

Any idea why this extra click is needed, is that an issue that needs solving?

It's just how Vuetify menu works. Click out-side first closes the menu, the next click opens the menu on the new position. This is fine for menu, but as a context menu this is a bit unexpected.

mariobuikhuizen avatar Sep 18 '23 21:09 mariobuikhuizen

Right, that means for solara, we probably need a custom template anyway. I found this example https://codesandbox.io/s/vuetify-context-menu-opened-multiple-times-idstb?file=/src/main.js which seems impossible to do without a vue template. cc @iisakkirotko

maartenbreddels avatar Sep 18 '23 22:09 maartenbreddels