google / blockly

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

[Bug] Flyout in toolbox without categories doesn't hide correctly #1851

Closed Bohdan-Tereta closed 6 years ago

Bohdan-Tereta commented 6 years ago

Problem statement

When toolbox has no categories, flyout doesn't hide correctly after creating element from one of its blocks. It still takes some space and responds to events preventing blocks to be moved to where flyout previously was

Expected Behavior

Block changes its position

Actual Behavior

Block disappears

Steps to Reproduce

  1. Go to https://blockly-demo.appspot.com/static/demos/fixed/index.html
  2. Run Blockly.getMainWorkspace().flyout_.autoClose = true in Chrome console
  3. Try to drag any block from flyout to workspace
  4. After block is created and flyout hides try to move a block to where flyout was before

Stack Traces

No errors in console

Operating System and Browser

Desktop Chrome, latest, didn't try in other browsers

Additional Information

Possible solution: add

if (this.autoClose) { this.hide(); this.clearOldBlocks_(); this.reflow(); }

to Blockly.createBlock() definition in flyout_base.js

rachel-fenichel commented 6 years ago

We don't support switching from an auto-closing flyout to an always-open flyout (or the other way around) without a reinjection. Too many pieces of our code are initialized based on which type of flyout it is.

Bohdan-Tereta commented 6 years ago

Thank you for an answer. The thing is this happens even without switching to auto-closing (maybe I've chosen not the best example in description). You can create a workspace with empty toolbox, set workspace.flyout_.autoClose = true; and after that populate a toolbox with blocks (I used no categories, blocks only). And this bug is reproducible in that case too. Can you please check that? Maybe we should reopen the issue.