Skip to content

Conversation

@almarklein
Copy link
Member

This PR:

  • Uses a <input type='text'> element to hold the focus (was previously an <a> element).
  • This prevents the notebook from capturing key presses and using them for shortcuts, like pressing 'a' to add a cell or 'd' to delete a cell.
  • This also allows capturing 'input' events to emit 'char' events, see Figure out how to handle unicode char events pygfx/rendercanvas#28 This is an experimental feature.
  • Specify in the spec that key_down and key_up events should not repeat.

cc @kushalkolar

@almarklein
Copy link
Member Author

This prevents the notebook from capturing key presses and using them for shortcuts, like pressing 'a' to add a cell or 'd' to delete a cell.

@kushalkolar have you or your users had trouble with this? I.e. making an interactive thingy with keyboard shortcuts but then not being able to use all keys because they are already captured by the notebook?

@almarklein
Copy link
Member Author

I replicated this in pygfx/rendercanvas#115, and found out that this does not work on Chrome; the focus element must not be a child of the canvas, otherwise Chrome considers it to not participate on the page, so it won't emit events.

I have found a solution (implemented in pygfx/rendercanvas#115), I'll add that here too. Or maybe not, because I'm also likely going to work on a solution based on AnyWidget soon ... :)

@kushalkolar
Copy link
Contributor

It would still be useful to have it here, at least for the next few months since I'm going to have people use some int input UI elements in imgui.

We can combine efforts on the anywidget side of things! 😄

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.

3 participants