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 fails to complete for collapsed procedure blocks that have been deserialised from JSON #6076

Closed
cmjcharlton opened this issue Apr 14, 2022 · 2 comments
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@cmjcharlton
Copy link

Describe the bug

If I attempt to drag and drop a collapsed procedure block that has been loaded from JSON the drag fails to complete and the block gets stuck to the mouse cursor.

To Reproduce

Steps to reproduce the behavior:

  1. Open the Blockly playground
  2. Click on 'Functions' in the toolbox
  3. Drag a procedure block into the workspace
  4. Right-click and collapse the block
  5. Click 'Save JSON'
  6. Click 'Load'
  7. Attempt to drag and drop the block

Expected behavior

The block should remain in the location where I release the mouse button and no errors should be reported in the developer console.

Screenshots

image

Desktop (please complete the following information):

  • OS: [Windows 10]
  • Browser [Chrome, Firefox]
  • Version [Chrome 100.0.4896.88 (Official Build) (64-bit), Firefox 99.0.1 (64-bit)]

Stack Traces

coordinate.js:134 Uncaught TypeError: Cannot read properties of null (reading 'x')
    at Function.module$exports$Blockly$utils$Coordinate.Coordinate.sum (coordinate.js:134:29)
    at BlockDragger.module$exports$Blockly$BlockDragger.BlockDragger.dragIcons_ (block_dragger.js:432:44)
    at BlockDragger.module$exports$Blockly$BlockDragger.BlockDragger.drag (block_dragger.js:212:10)
    at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.startDraggingBlock_ (gesture.js:466:24)
    at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.updateIsDraggingBlock_ (gesture.js:397:12)
    at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.updateIsDragging_ (gesture.js:447:14)
    at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.updateFromEvent_ (gesture.js:288:12)
    at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.handleMove (gesture.js:555:10)
    at module$exports$Blockly$TouchGesture.TouchGesture.handleMove (touch_gesture.js:186:13)
    at HTMLDocument.h (browser_events.js:88:9)
module$exports$Blockly$utils$Coordinate.Coordinate.sum @ coordinate.js:134
module$exports$Blockly$BlockDragger.BlockDragger.dragIcons_ @ block_dragger.js:432
module$exports$Blockly$BlockDragger.BlockDragger.drag @ block_dragger.js:212
module$exports$Blockly$Gesture.Gesture.startDraggingBlock_ @ gesture.js:466
module$exports$Blockly$Gesture.Gesture.updateIsDraggingBlock_ @ gesture.js:397
module$exports$Blockly$Gesture.Gesture.updateIsDragging_ @ gesture.js:447
module$exports$Blockly$Gesture.Gesture.updateFromEvent_ @ gesture.js:288
module$exports$Blockly$Gesture.Gesture.handleMove @ gesture.js:555
module$exports$Blockly$TouchGesture.TouchGesture.handleMove @ touch_gesture.js:186
h @ browser_events.js:88

Additional context

The error does not occur if I save/load to XML format.

I encounter the same problem in my own application using the current (Q1 2022) release.

@cmjcharlton cmjcharlton added the issue: triage Issues awaiting triage by a Blockly team member label Apr 14, 2022
@alschmiedt
Copy link
Contributor

Thanks for reporting!

Confirming that this is happening and that it does not look like it is regression. It looks like this has been happening since the September beta release.

@alschmiedt alschmiedt added issue: bug Describes why the code or behaviour is wrong and removed issue: triage Issues awaiting triage by a Blockly team member labels Apr 14, 2022
tweini added a commit to tweini/blockly that referenced this issue Apr 20, 2022
tweini added a commit to tweini/blockly that referenced this issue Apr 21, 2022
BeksOmega pushed a commit that referenced this issue Apr 21, 2022
#6081)

* fix: 6076 "dragging fails" improved

* fix: "dragging fails (bug #6076)" tested version

* fix: "dragging fails (bug #6076)" moved fix-code after L625
@cmjcharlton
Copy link
Author

Hi @tweini, as requested in #6091 I have now done some manual testing with your fix applied. Dragging now appears to work correctly for all the examples that I tried too. Thanks for tracking down the cause and fixing this.

BeksOmega pushed a commit to BeksOmega/blockly that referenced this issue Apr 28, 2022
google#6081)

* fix: 6076 "dragging fails" improved

* fix: "dragging fails (bug google#6076)" tested version

* fix: "dragging fails (bug google#6076)" moved fix-code after L625
BeksOmega pushed a commit to BeksOmega/blockly that referenced this issue Apr 28, 2022
google#6081)

* fix: 6076 "dragging fails" improved

* fix: "dragging fails (bug google#6076)" tested version

* fix: "dragging fails (bug google#6076)" moved fix-code after L625
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