Blockly: Trashcan duplicates disabled blocks when maxBlocks is hit

Created on 14 Oct 2019  路  3Comments  路  Source: google/blockly

  • Go to https://blockly.games/maze?level=3
  • Drag a 'move forward' block from the toolbox to the trashcan.
  • Drag a 'move forward' block from the toolbox to the workspace (this trips maxBlocks).
  • Open the trashcan and drag the 'move forward' block back into the trash.
  • Open the trashcan.

Expected result: one disabled 'move forward' block.

Actual result: two disabled 'move forward' blocks.

Notes: One of the blocks in he trash flyout is disabled, the other is enabled, but as a result of maxBlocks getting hit everything is disabled.

More importantly, this application does not have user-selectable enabling and disabling of blocks. Which means a disabled block pulled from the trashcan is forever useless.

Suggestion: If disabled:false is in the config, then one should not be able to drag disabled blocks out of the trashcan. Currently one can't drag disabled blocks out of a toolbox flyout.

trash flyout triage bug

All 3 comments

Hmm, that suggestion won't work for Bird, where blocks disable due to being orphans not due to maxBlocks.

Alternative suggestion: If disabled:false is in the config, deleted blocks should have their disabled status cleared when being added to the trashcan list.

Hmm, that suggestion won't work for Bird, where blocks disable due to being orphans not due to maxBlocks.

Alternative suggestion: If disabled:false is in the config, deleted blocks should have their disabled status cleared when being added to the trashcan list.

@NeilFraser Is the following case important?

A block is disabled for demonstration purposes, the user is not allowed to enable this block, or create an enabled version of this block.

Because I think the proposed solution would break that case. I.E. you could delete the disabled block, the trash can would enable it, then you could drag it out of the trashcan, allowing you to create an enabled version.

Honestly I hope it's not important, b/c just removing disabled tags would make the trashcan code look nicer hehe.

That's a very good question. First, I haven't seen that case in use. Second, I'd think that in such a case one would almost certainly want the block to be undeletable (since it's unlikely one would want to be providing the disabled demo block in the toolbox).

And if the offending block is undeletable, then the problem goes away. :)

Was this page helpful?
0 / 5 - 0 ratings