Is there are way we can propagate a keydown event to browser to do default action? For example, with Ctrl + P we can print page, but it doesn't work with ipyevents as expected.
Related to this is another option of dispatching a new event when a key is pressed, e.g. let say I press key Ctrl + P and it does not propagate to notebook/browser that is fine, but what if I can handle that by adding something like:
def handle_keydown(event):
if event["ctrlKey"] and event["code"] == "p":
ipyevents.propagate() # This is less flexible,
# OR
ipyevents.dispatch_javascript_event("window.print();") # if such function exists, it is much more flexible
This second way to dispatch events selectively looks better than just passing events to browser. I am looking specifically for window.dispatchEvent(new Event('resize')); on press of some key or some layout change of widgets.
Is there are way we can propagate a keydown event to browser to do default action? For example, with
Ctrl + P
we can print page, but it doesn't work withipyevents
as expected.Related to this is another option of dispatching a new event when a key is pressed, e.g. let say I press key
Ctrl + P
and it does not propagate to notebook/browser that is fine, but what if I can handle that by adding something like:This second way to dispatch events selectively looks better than just passing events to browser. I am looking specifically for
window.dispatchEvent(new Event('resize'));
on press of some key or some layout change of widgets.