Skip to content

fix: forward keyboard events after clicking sprite selector#619

Open
Chessing234 wants to merge 2 commits into
scratchfoundation:developfrom
Chessing234:fix/10047-keyboard-after-sprite-select
Open

fix: forward keyboard events after clicking sprite selector#619
Chessing234 wants to merge 2 commits into
scratchfoundation:developfrom
Chessing234:fix/10047-keyboard-after-sprite-select

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

handleKeyDown ignored any keydown whose event target was not document or document.body. Clicking a sprite in the selector moves focus to that element, so hat blocks like "when space key pressed" stopped receiving key events until focus returned to the document (e.g. green flag).

The guard now only skips editable targets (inputs/textareas/contenteditable), matching the Blockly intent of the original comment.

Fixes scratchfoundation/scratch-gui#10047

Test plan

  • Add a "when space key pressed" hat block
  • Press space — sprite responds
  • Click the sprite in the sprite list — press space again — sprite still responds
  • Typing in a Blockly number/text field still goes to the field, not the VM

Made with Cursor

handleKeyDown skipped any keydown whose target was not document/body,
so selecting a sprite left focus on that element and blocked hat blocks.
@Chessing234 Chessing234 requested a review from a team as a code owner June 24, 2026 12:21
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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.

Keyboard events stop firing after selecting a sprite in UI until green flag is clicked

1 participant