Skip to content

Unexpected movement when inserting blocks from toolbox (keyboard) #10183

Description

@microbit-robert

Check for duplicates

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

Description

There is at least one scenario when a container block in the top left of the workspace is mysteriously pushed down when the user adds a statement block to an unrelated container block. Please see the reproduction steps and video recording for more information as this one is difficult to explain.

Reproduction steps

  1. Go to the Blockly test deployment
  2. Using keyboard, add a new function container block in the default position (top left)
  3. Press T to return to the toolbox and add a return statement. This will automatically be placed inside in the function container block. Accept the position
  4. Press T to return to the toolbox and add a second function container block (identical to the first). This will be placed to the right hand side of the first function block. Accept the position.
  5. Press T to return to the toolbox and add a statement block that is larger / taller than the return statement block you added to the first function container. In the example below, I used the repeat block. This will be placed inside the second function container block
  6. Observe that the first function container block has been pushed down the workspace slightly - it is not clear why. It doesn't matter if you accept the statement block position or discard it at this point.
  7. Press C to clean up the code. The second function block is now above the first function block as a result of the first function block getting pushed down. This matters more for MakeCode when you add a Button A handler, then a Button B handler, but their positions after switched after the cleanup function runs.

Priority

Work effort: Unknown. We suspect that the block is initially placed in the top left (unseen by the user) before being moved to the correct position and this might be causing the shift, but this is speculation.

Impact: We don't know how many people this affects, but it is certainly more of a quirk, and doesn't need urgent attention.

Stack trace

Screenshots

Video of behaviour in the Blockly deployment:
https://github.com/user-attachments/assets/622335b7-21dd-44cd-9cc0-a0dc248be528

Screenshot in MakeCode before cleanup:
Image

Screenshot in MakeCode after cleanup:
Image

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triageIssues awaiting triage by a Blockly team member

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions