Problem with expandable arguments + an enum picker in custom block

I’m playing around with making some custom blocks, and I’m running into an issue with expandable arguments coupled with an enum picker.

Everything seems to work fine with either feature (my function with expandable arguments but no enum parameter OR my function with an enum picker but no expandable arguments). But when I use them in combination the block breaks (gets stuck to the cursor; can’t be trashed) when I interact with the + expander.

Here’s my custom.ts—if it’d be better to publish a project I could do that too.

enum Anchor {
    //% block="top left"
    //% block="bottom right"

namespace inputs {
    //% block="show a simple menu with %options||anchor %anchor foreground %foreground background %background"
    //% expandableArgumentMode=toggle
    //% anchor.defl=TopLeft
    //% foreground.shadow=colorindexpicker
    //% foreground.defl=1
    //% background.shadow=colorindexpicker
    //% background.defl=15
    export function showSimpleOptionMenu(options: string[], anchor: Anchor, foreground: number, background: number) {
        return 0; // index of selected option

Am I doing something wrong? Thanks!

Nope, your authoring is fine, just a bug in the blocks rendering (block sticking to cursor is almost a guaranteed uncaught exception in blockly). Just tested in beta and the updates fixed it, so this will be fixed in the next release :slight_smile:


I’ll avoid this combination of features until the next release.