Skip to content

fix: forward keyboard events after clicking sprite selector - #619

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

fix: forward keyboard events after clicking sprite selector#619
Chessing234 wants to merge 1 commit 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

@Chessing234
Chessing234 requested a review from a team as a code owner June 24, 2026 12:21
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Only skip forwarding keydown events from text inputs and contentEditable
elements instead of blocking all non-document targets.

Addresses the same root cause as scratchfoundation/scratch-gui#10047.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234
Chessing234 force-pushed the fix/10047-keyboard-after-sprite-select branch from 86e328d to 37423a4 Compare July 29, 2026 16:00
@Chessing234

Copy link
Copy Markdown
Author

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

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