Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging in from the flyout sometimes bumps unexpectedly #8769

Open
1 task
rachel-fenichel opened this issue Feb 14, 2025 · 1 comment
Open
1 task

Dragging in from the flyout sometimes bumps unexpectedly #8769

rachel-fenichel opened this issue Feb 14, 2025 · 1 comment
Assignees
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@rachel-fenichel
Copy link
Collaborator

Check for duplicates

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

Description

Image

If the root block is at or near 0, 0 and another (not yet understood) set of conditions is met, a bump occurs when dragging a block out of the flyout. It also occurs when creating a block from the flyout with the keyboard experimentation plugin.

This happens because of a render that is triggered in serialization.blocks.append when called from flyout_base.placeNewBlock and can be resolved by switching to blocks.appendInternal to avoid the immediate render, but we want to understand the issue more before making that change.

Reproduction steps

Open the playground and load this JSON:

{
  "blocks": {
    "languageVersion": 0,
    "blocks": [
      {
        "type": "controls_repeat_ext",
        "id": "$~GZGETMKa80_E_cnRR4",
        "x": 0,
        "y": 0,
        "inputs": {
          "TIMES": {
            "shadow": {
              "type": "math_number",
              "id": "~#{8T0:+h23YhNbVGTF+",
              "fields": {
                "NUM": 10
              }
            }
          }
        }
      }
    ]
  }
}

Then drag the workspace (not the block) to offset it away from the flyout for visibility.
Then open the Logic category and slowly drag out an if block.

Notice that the repeat block is bumped sideways as the if block appears.

Stack trace

Screenshots

No response

Browsers

No response

@rachel-fenichel rachel-fenichel added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member labels Feb 14, 2025
@cpcallen cpcallen removed the issue: triage Issues awaiting triage by a Blockly team member label Feb 14, 2025
@gonfunko
Copy link
Contributor

In looking at this, the set of conditions is that the block at ~(0, 0) has compatible connections with the block being dragged within the snap radius, assuming the block being dragged is positioned at (0, 0). This is because the block being dragged gets initially created at the origin, then rendered, which calls bumpNeighbours() as part of its ordinary operation. There are checks to not do this for blocks being dragged, but since there's quite a lot of indirection in terms of gestures/draggers/drag strategies/draggables, at the time the new block is initially being rendered it (and the workspace) haven't yet been marked as dragging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

3 participants