Skip to content

accept Symbol (or callback function) for dropdown menu #9596

@SimonShiki

Description

@SimonShiki

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

As Blockly Guide mentioned:

The dropdown field stores a string as its value and a string as its text. The value is a language-neutral key that will be used for accessing the text and will not get translated when Blockly is switched between languages.

However, consider below code:

Image

When sound.name is SOUND_RECORD, the validator appears to be called repeatedly. I'm not entirely sure of the best fix, but a few possible approaches might include escaping special strings or restricting their appearance in certain places. It could also be worth considering whether allowing the value to be a Symbol or a callback function might help — though I'd love to hear if others have better ideas or if I'm misunderstanding something about the intended behavior.

Request

Allow the values of menu in field_dropdown to be Symbol or callback function.

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: feature requestDescribes a new feature and why it should be addedissue: triageIssues awaiting triage by a Blockly team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions