Scratch-blocks: Deleting a hat block incorrectly implies deleting a single block

Created on 8 Nov 2018  路  9Comments  路  Source: LLK/scratch-blocks

Expected Behavior

When you right click on a block and you select the option Delete block, it should delete one block.

Actual Behavior

delete

Right clicking on a hat block uses the message Delete block but it deletes the whole stack. Either the message should indicate that more blocks will be deleted, or only delete the hat block.

Note clicking on the forever when it contains a block the context menu says Delete 2 blocks.

Operating System and Browser

MacOS Chrome

needs discussion needs-triage

Most helpful comment

My understanding is that "delete" in the context menu is designed so that you don't have to perform a three step process to delete a single block:

  1. Drag out tail of the script
  2. Drag out the block you want to delete
  3. Return the tail of the script to the head thereof

With a hat block, you can just drag the entire script into the trash if that's what you want to do. If you, however, want to swap the event which triggers the action (e.g. arrow keys vs green flag), there should be a quick way to do that.

All 9 comments

Presumably, the blocks that come "after" a hat block are really children of that hat block, and so are deleted by this chunk of the code: https://github.com/LLK/scratch-blocks/blob/b63e5c62d3c3b88ddde3df1d4062a5432b5a116c/core/block.js#L287-L290

Probably a special-case for hat blocks would be the most practical here; I think it at would take less work than rewriting hat blocks so that blocks are considered "connected" instead of children!

@rachel-fenichel I think your "special case should be here" describes changing the number of blocks in the context menu option, whereas mine is (maybe not very clearly) about deleting just the hat block instead of its children. IMO mine makes more sense, because users will intuitively expect that "that option" = "delete just this block", from having used it on plenty of not-hat blocks.

Good point--where the special case goes will depend on which behaviour they pick.

I checked and the current behavior (delete the whole stack) is consistent with Scratch 2.0. So the fix is probably to change the message so that it conveys that it will delete the number of blocks in the stack. (In 2.0 it just says 'delete').

@chrisgarrity you're right, but this is a case where we can make a change so that the menu option is more intuitive and useful in Scratch 3.0. Anyway, you aren't exactly right, because in fact the delete right-click option, in 2.0, deletes following blocks from any block; for example right-click deleting "move 10 steps" in "move 10 steps, turn 15 degrees" will delete both blocks, whereas in 3.0 (as intended) it will only delete the "move 10 steps" block.

My understanding is that "delete" in the context menu is designed so that you don't have to perform a three step process to delete a single block:

  1. Drag out tail of the script
  2. Drag out the block you want to delete
  3. Return the tail of the script to the head thereof

With a hat block, you can just drag the entire script into the trash if that's what you want to do. If you, however, want to swap the event which triggers the action (e.g. arrow keys vs green flag), there should be a quick way to do that.

Thanks @joker314. Agreed!

/cc @carljbowman @kathymakes

Not too sure, but this may be a duplicate of #245. https://github.com/LLK/scratch-blocks/issues/245#issuecomment-376341121 describes a potential way to look into fixing this. More importantly, the new PR #1814 probably fixes this issue too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisandagain picture thisandagain  路  5Comments

towerofnix picture towerofnix  路  5Comments

bfunc picture bfunc  路  5Comments

MegaApuTurkUltra picture MegaApuTurkUltra  路  4Comments

tmickel picture tmickel  路  3Comments