Skip to content

Fix Jupyter notebook keyboard input handling#60

Merged
brendancol merged 1 commit intomasterfrom
fix/jupyter-keyboard-controls
Feb 27, 2026
Merged

Fix Jupyter notebook keyboard input handling#60
brendancol merged 1 commit intomasterfrom
fix/jupyter-keyboard-controls

Conversation

@brendancol
Copy link
Contributor

@brendancol brendancol commented Feb 27, 2026

Summary

  • Use data-lm-suppress-shortcuts attribute to prevent JupyterLab/Lumino from intercepting keyboard shortcuts on the viewer widget, instead of stopPropagation() which blocked ipyevents from receiving key events
  • Disable/enable Classic Notebook keyboard manager on focus/blur to prevent notebook shortcuts (e.g. x deleting cells) from firing while the viewer is focused
  • Suppress escape and x exit keys in Jupyter since they're too easy to hit accidentally — use widget.stop() instead
  • Set ipyevents wait=0 for lower-latency keyboard/mouse input
  • Consolidate startup print into a single line

Test plan

  • Open explore() viewer in JupyterLab — verify WASD/arrow keys, R/Shift+R, H, and mouse controls all work without triggering notebook shortcuts
  • Verify clicking the image shows blue focus border, clicking outside removes it
  • Verify x and escape do not close the viewer
  • Verify widget.stop() still works to close the viewer
  • Test in Classic Notebook if available — verify keyboard manager is disabled/enabled on focus/blur

@brendancol brendancol merged commit 63ac969 into master Feb 27, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant