Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally passing some events to browser #77

Open
asaboor-gh opened this issue Dec 25, 2022 · 0 comments
Open

Optionally passing some events to browser #77

asaboor-gh opened this issue Dec 25, 2022 · 0 comments

Comments

@asaboor-gh
Copy link

asaboor-gh commented Dec 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant