google / blockly

The web-based visual programming editor.
https://developers.google.com/blockly/
Apache License 2.0
12.52k stars 3.72k forks source link

Empty action is added to the undo stack when dragging block directly from the toolbox to trash #1458

Open vicng opened 7 years ago

vicng commented 7 years ago

Problem statement

If you drag a block directly from the toolbox straight into the trash, this generates an "undo" action. Rewinding this "undo" action does nothing.

Expected Behavior

No "undo" action should be added to the undo/redo stack.

Actual Behavior

All relevant events (create, move, delete) are added to the stack as a group.

Steps to Reproduce

1) Open the toolbox and add a block to the workspace. 2) Now, drag another block straight from the toolbox and into the trash. 3) Undo the action (Ctrl-Z/Cmd-Z) -> Nothing happens (step 1 should be the thing that's undone).

Additional Information

I think the ideal behavior is to remove these events from the event stack, if this scenario is detected.

cpcallen commented 3 months ago

This also occurs if you drag a block from the toolbox and then, before placing it, delete it by dragging it back to the toolbox/flyout.