# For element ... block editor bug

**URL:** https://forum.makecode.com/t/for-element-block-editor-bug/1673
**Category:** Arcade
**Created:** [April 12, 2020, 5:17am UTC](https://forum.makecode.com/t/for-element-block-editor-bug/1673 "2020-04-12T05:17:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jacob\_c](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jacob_c/32/1532_2.png) [@jacob\_c](https://forum.makecode.com/u/jacob_c)
#### Post date: [April 12, 2020, 5:17am UTC](https://forum.makecode.com/t/for-element-block-editor-bug/1673/1 "2020-04-12T05:17:37Z")

</div>

I encountered a pretty severe block editor bug with the `for element [value] of [list]` block. Steps to repro:

1. in a brand new project, drag a `for element [value] of [list]` block into the `on start`.
2. click the drop-down next to `list` and select `Delete the "list" variable`.
3. click the same drop-down again and the block becomes stuck to the cursor. It cannot be trashed or placed. Undo doesn’t work. The only way I was able to recover was reloading the page. (Thankfully nothing was lost!)

It looks like there’s a script error associated with opening the menu the second time:

```auto
Uncaught TypeError: Cannot read property 'type' of null
    at Blockly.FieldVariable.dropdownCreate [as menuGenerator_] (pxtblockly.js:1)
    at Blockly.FieldVariable.Blockly.FieldDropdown.getOptions (pxtblockly.js:1)
    at Blockly.FieldVariable.Blockly.FieldDropdown.showEditor_ (pxtblockly.js:1)
    at Blockly.TouchGesture.Blockly.Gesture.doFieldClick_ (pxtblockly.js:1)
    at Blockly.TouchGesture.Blockly.Gesture.handleUp (pxtblockly.js:1)
    at Blockly.TouchGesture.handleUp (pxtblockly.js:1)
    at HTMLDocument.i (pxtblockly.js:1)

```

after which there are warnings after every click:

```auto
Tried to start the same gesture twice.

```

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [April 12, 2020, 8:58am UTC](https://forum.makecode.com/t/for-element-block-editor-bug/1673/2 "2020-04-12T08:58:05Z")

</div>

Hm, weird bug, good catch. It looks like it’s actually fixed in /beta / our current development branches, as we have had a bunch of updates to blockly since the last release of arcade and one of them must have incidentally fixed this
