-
Notifications
You must be signed in to change notification settings - Fork 27
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
Mousemove events not emitted after shift+mousedown with button 1 in Jupyter Lab #74
Comments
Thanks for the report @edwardwkrohne -- I'm hoping to fix it this week while I'm at a workshop with some jupyterlab devs. |
With some help from Afshin Darian I found the root cause of this. It turns out the notebook in JupyterLab captures
This happens on the mousedown event, which is why the order of pressing the shift key matters: if you are not holding the shift key when you press the left mouse button then the event capture does not happen. If you have selected some text before pushing the shift key it also doesn't happen. There is not a great workaround, though Darian said jupyterlab might be willing to add an API for turning off the event capture in this case. I'm not sure why jupyterlab grabs this case beyond this comment. I'll try to think of a workaround in ipyevents, though it would be a little hacky and I'm not sure I can actually get it to work, or what it might break... |
Thank you! This is great to know. Since you've read the code surrounding this already, what do you think my odds would be if I were to make a source install of JupyterLab and comment out that one line? Would it be sufficient to do shift+draw? Would it have unpleasant consequences? Looking at the blame and the PR the line was written at, it was added to address things like browser context menus showing up when the Jupyter one needed to be shown. |
With the caveat that I'm not an expert in this code base, I think the line that prevents the event from getting to That said, commenting out the One thought would be to move the Another thought, which would mean not having to modify jupyterlab itself, would be to select some text in the output cell whenever the mouse enters the element that ipyevents is attached to. If something is selected when this conditional is hit, then that branch is not entered, and the mousemove listener that stops propagation isn't added. I don't of a great way to make that selection happen, though I think it will have to be on the js side, not the python side. |
I'm trying to allow the user to "draw" a line across a widget, and have the shift key have special meaning. I check mousemove events with button 1 depressed to do regular drawing, but for shift+draw, no events are emitted by ipyevents.
The following code has been modified from the example notebook.
In Jupyter Lab,
In Jupyter Notebook, all events I just listed are displayed appropriately. Adding
prevent_default_action=True
had no effect.produces
and
produces
I upgraded from JupyterLab 3.4.0 to make this report; I got identical behavior in both versions.
The text was updated successfully, but these errors were encountered: