Skip to content

Fix keyboard events dropped after selecting sprite in UI#620

Open
Chessing234 wants to merge 1 commit into
scratchfoundation:developfrom
Chessing234:fix/vm-listener-keyboard-events-10047
Open

Fix keyboard events dropped after selecting sprite in UI#620
Chessing234 wants to merge 1 commit into
scratchfoundation:developfrom
Chessing234:fix/vm-listener-keyboard-events-10047

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • Forward keydown events to the VM unless the event target is a text input, textarea, or contentEditable element
  • Replaces the previous check that dropped keys for any non-document/SVG target, which caused key-sensing blocks (e.g. "when space key pressed") to stop working after clicking a sprite in the sprite selector

Fixes the same root cause reported in scratchfoundation/scratch-gui#10047 (that repo is archived; this monorepo is the active home for scratch-gui).

Test plan

  • Add a "when space key pressed" block and confirm space still triggers it after clicking a sprite in the sprite list
  • Confirm Blockly number/text field inputs still accept typing without forwarding keys to the VM
  • Run npm test -- --testPathPattern=vm-listener-hoc in packages/scratch-gui

Made with Cursor

Only skip forwarding keydown events from text inputs and contentEditable
elements instead of blocking all non-document targets. Fixes key-sensing
blocks stopping after selecting a sprite in the sprite list.

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

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234 Chessing234 requested a review from a team as a code owner June 24, 2026 12:24
@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.

1 participant