scratchfoundation / scratchfoundation/scratch-blocks

Code Block Undo event allowed to bubble causing issues

Open
#2,819 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Low Prevalence Medium Severity priority 3
Dominant language
JavaScript
Stars
2.8k
Forks
1.6k
Avg merge
4h 51m
Merged PRs (30d)
12

Description

Actual Behavior

When you press Ctrl+Z repeatedly after placing blocks, the focus will change to the sprite name, or other input boxes and undo any changes you made there too earlier. The undo even needs to be prevented from bubbling up I suspect?

Steps to Reproduce

Steps to reproduce the behavior:

  1. Start a new project
  2. From the coding tab, Rename the sprite to "Testing"
  3. Now drop in a few blocks
  4. Press Ctrl+Z a few times

At this point the focus changes back to the sprite name after one click (at the same time as the last block disappears)
Then on the second press the 2nd block disappears, but the sprite is also renamed back to "sprite1"
And on the next press the other blocks continue to disappear.

Because the blocks do get undone... you can easily have awful things happen without realising it. Also, sprite renames across sprites can be undone causing concatenation of sprite names, and all sorts of badness!

System Details

Win 10, PC

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in a new project from the coding tab, following the listed sprite-rename and block-placement steps. Trace the Ctrl+Z handling and event propagation from the block editor; done means repeated undo removes blocks without moving focus to inputs or reverting sprite names.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.