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

JupyterLab keybinding issues #31

Closed mwcraig closed 5 years ago

mwcraig commented 5 years ago

My hack of key events seems to fail miserably in jupyterlab. It works fine until you press a key that is also interpreted by the notebook (e.g. the 1 key which sets the cell type to Heading 1). Then the notebook executes the command (e.g. changing the cell type) and the handler which had been bound to the cell becomes bound to the document instead (I think).

Once in that state pushing a key anywhere in the notebook makes the handler react (which makes sense) and the default action for the key happens. Need to figure out a better way of attaching things in lab...

Even better, you cannot then type anywhere in the notebook because there is a document-level event handler that swallows the event...

mwcraig commented 5 years ago

One immediate thought: add a handler for whatever event is triggered when a DOM elements is destroyed so that we can at least remove the handlers properly....

mwcraig commented 5 years ago

And, even better, once you end up in this state any new notebooks you create also won't let you type...

jasongrout commented 5 years ago

For discussion, see https://github.com/jupyterlab/jupyterlab/issues/5816