google / blockly-keyboard-experimentation

Apache License 2.0
2 stars 4 forks source link

Move keyboard focus to runtime environment when triggering code to run #48

Open rachel-fenichel opened 2 months ago

rachel-fenichel commented 2 months ago

In the test page the user can trigger the code to run by pressing Shift+R from the Blockly workspace, or by pressing the "run code" button. In either case the p5.js context should receive following key-presses.

For testing purposes I'm making an "on space pressed" block that can trigger actions in the p5 context.

In the broader scope, most blockly-based applications have a code workspace and a runtime. Many of them expect interaction with the runtime: micro:bit has a simulator that can be clicked and tilted, code.org has clicking in flappy bird, and so on. That means we need to have a standard way to move between the workspace and the runtime, since we don't want keypresses aimed at (e.g.) playing a game in the runtime to actually move blocks around in the blockly workspace.

rachel-fenichel commented 2 months ago

See https://github.com/google/blockly-keyboard-experimentation/discussions/49 for the broader discussion and https://github.com/google/blockly-keyboard-experimentation/issues/27 for the inverse action.