mwcraig / ipyevents

A custom widget for returning mouse and keyboard events to Python. Documentation:
https://ipyevents.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
112 stars 27 forks source link

Cannot use input widgets whilst listening to keyboard events #57

Open agoose77 opened 4 years ago

agoose77 commented 4 years ago

This might only apply to the FloatText/IntText, but I assume it might be a broader issue.

By calling preventDefault on the widget, we lose the ability to enter values into widgets.

https://github.com/mwcraig/ipyevents/blob/b6a94c7588f071118fa27cb5b7e9f4aacca9ef5d/src/events.ts#L268-L269

Perhaps a solution here would be to enable a list of keycodes that are either ignored, or always blocked. I was thinking otherwise the Python event handler could veto the blocking, but that would add the roundtrip time to each event :vomiting_face:

mwcraig commented 3 years ago

I'm not quite sure what to do about this. The original motivation for this was to make sure that handlers for keyboard events didn't have to worry about colliding with the default notebook keyboard shortcuts (I had particular issues with d``d colliding with a handler I was working on.

Is your case that the text widget is the one whose events you are watching or is it that a text widget is inside some other, larger, widget that you are handling events for?