microsoft / microsoft/pxt

Custom field dropdowns: shadow blocks are serializing functions not meant to be exposed

Open
#7,834 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
641
Avg merge
12h 4m
Merged PRs (30d)
57

Description

Custom field editors are serializing out the contents of their shadow blocks instead of their literal values.

This serialization problem is also appearing in the BuildBee MakeCode color picker. I had to expose the shadow block in the API so that it would not look strange. But it looks like the feature is broken?

** PXT Playground Example **

Load up PXT playground, example field-editors-dropdowns
https://makecode.com/playground#field-editors-dropdowns
Hit the run button
image
Add the "Say hello" block
image
Flip the editor to Javascript
image

Expected
Since the __wordPicker function is marked as blockHidden, and it is a shadow field editor, I expect the correct serialization to be time.say("Hello")

Actual
It seems to generate javascript that can't be compiled (this is worse than what I'm seeing on BuildBee using number types)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Load the PXT Playground example field-editors-dropdowns and reproduce the shadow-block dropdown serialization through the documented steps. Trace the custom field editor path that produces the JavaScript output, then verify that the hidden __wordPicker shadow field serializes to time.say("Hello") and that the result compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.