Py.Cafe

iisakkirotko/

ipyvuetify-tooltip-bug

blur, keydown, and focus events not working inside v.Tooltip

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import solara
import ipyvuetify as v


text = solara.reactive("")

def set_text(value):
    print("Setting text:", value)
    text.set(value)

t_field = v.TextField(label="texty", v_model=text.value, on_v_model=set_text)

page = v.Tooltip(
    children=["Tip tool"],
    v_slots=[
        {
            "name": "activator",
            "variable": "tooltip",
            "children": t_field,
        }
    ]
)

t_field.v_on = "tooltip.on"
t_field.on_event("blur", lambda *_: print("Bluuuur"))
t_field.on_event("keydown", lambda *_: print("KEYY presed"))
t_field.on_event("focus", lambda *_: print("FOCCUs"))
# t_field.on_event("focusout", lambda *_: print("FOCUS OUT"))
# t_field.on_event("focusin", lambda *_: print("Focus in"))