Problem with using "lists_create_with" shadow block

Hi everyone,

In our custom PXT project, we had been using PXT version 6.1.19 for a long time. A few weeks ago, we updated to version 11.3.12.

One of our blocks requires a custom array, which relies on the “lists_create_with” shadow block. However, due to a change in how this shadow block behaves, it now expands vertically instead of horizontally when more than three items are added to the array. This leads to overlapping issues in the extension’s toolbox. (I would upload an image, but unfortunately, that doesn’t seem to work.)

Does anyone know if there’s a way to revert this behavior so that the block expands horizontally again? Or is there an alternative solution to fix this issue?

Here’s how the block is currently defined:

 /**
  * Moves kinematic of the target device to a position w.r.t. a coordinate system
  * @param type movement absolute or relative
  * @param cos the coordinate system
  * @param values the distances or positions of movement
  * @param velocity the max velocity
  * @param acceleration acceleration and deceleration
  * @param jerk acceleration and deceleration jerk
  */
//% block="move %this $type $cos to $positions with $velocity, $acceleration and jerk $jerk   "
//% this.fieldEditor="dropdownKinematic"
//% this.fieldOptions.property="kins"
//% positions.shadow="lists_create_with"
//% positions.defl="create_kin_pos"
//% velocity.shadow="kinVelocityPicker"
//% jerk.shadow="kinJerkPicker"
//% jerk.defl="0"
//% cos.fieldEditor="dropdownCOS"
//% acceleration.shadow="kinAccelerationPicker"
//% inlineInputMode=inline
//% promise
//% help=motion/kinematic/kinematic-movepositions-ext
//% group="Kinematics"
movePositionsEx(type: MoveType, cos: COS, positions: Position[], velocity: number, acceleration: number, jerk: number): void;

Any help or insights would be greatly appreciated!

Thanks,
tschanni

1 Like

It sounds like the change you’re seeing is due to updates in how lists_create_with renders in Blockly after the PXT 11.x update. In earlier versions (like 6.1.x), Blockly’s list shadow block defaulted to horizontal layout for small item counts, but in newer versions, the layout engine defaults to vertical stacking once you go past three inputs — even inside inline blocks.

This isn’t a bug in your block definition, it’s an upstream change in the core Blockly rendering logic. The inlineInputMode=inline metadata affects your outer block layout, but doesn’t force lists_create_with to keep its older horizontal style.

If you want the old behavior back, you have two main options:

  1. Custom shadow block – Make your own lists_create_with variant that explicitly sets input layout to horizontal.

  2. Post-processing hook – Modify the generated Blockly XML before it’s loaded so the list block starts with a different layout setting.

Option 1 is the cleaner approach for long-term maintenance. You’d basically copy the original lists_create_with code from Blockly’s source, tweak the input arrangement, and register it as a custom block in your extension.