blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Shadow Block Converter Plugin Parent Block Visual Selection Bug

Open changminbark opened this issue 1 year ago • 7 comments

Check for duplicates

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

Component

Shadow Block Converter Plugin

Description

I think that I've come across a bug where editing a shadow block will select the parent block (at least visually). However, when trying to select something else (like a block or the workspace), the former shadow block's parent block does not get unselected (visually). This was tested without any of the other plugins (except for backpack). I will report this on the Blockly plugins github page. Look at the gif below for reference.

Reproduction steps

Stack trace

No response

Screenshots

shadowblock_converter

changminbark avatar Jul 30 '24 15:07 changminbark

@johnnesky: Would you like to take a look at this?

cpcallen avatar Aug 02 '24 16:08 cpcallen

Sure!

johnnesky avatar Aug 02 '24 17:08 johnnesky

Hm, I'm having trouble replicating the problem at the shadow block converter demo page. @changminbark, can you share more information? What version of Blockly are you using? Do you have any of your own customizations we should know about? Is there a public demo we can try?

https://github.com/user-attachments/assets/f1e053ad-0b9f-4e4e-9aa9-9b4131f1d250

johnnesky avatar Aug 02 '24 18:08 johnnesky

@johnnesky

Hello! I am currently testing this on Blockly v11.1.1. Below is my package.json file.

{
  "name": "@mit-app-inventor/blockly-plugin-workspace-multiselect",
  "version": "1.0.0",
  "description": "A Blockly plugin that allows to drag, select and doing actions on multiple blocks in the workspace.",
  "scripts": {
    "audit:fix": "blockly-scripts auditFix",
    "build": "blockly-scripts build",
    "clean": "blockly-scripts clean",
    "lint": "eslint . --fix",
    "predeploy": "blockly-scripts predeploy",
    "prepublishOnly": "npm run clean && npm run build",
    "start": "blockly-scripts start",
    "test": "blockly-scripts test"
  },
  "main": "./dist/index.js",
  "module": "./src/index.js",
  "unpkg": "./dist/index.js",
  "author": "Songlin Jiang",
  "keywords": [
    "blockly",
    "blockly-plugin",
    "workspace-multiselect"
  ],
  "homepage": "https://github.com/mit-cml/workspace-multiselect/#readme",
  "bugs": {
    "url": "https://github.com/mit-cml/workspace-multiselect/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mit-cml/workspace-multiselect.git"
  },
  "license": "Apache-2.0",
  "directories": {
    "dist": "dist",
    "src": "src"
  },
  "files": [
    "dist",
    "src"
  ],
  "dependencies": {
    "@blockly/disable-top-blocks": "^0.5.6",
    "@blockly/keyboard-navigation": "^0.6.4",
    "@blockly/shadow-block-converter": "^6.0.5",
    "@blockly/workspace-content-highlight": "^5.0.5",
    "dragselect": "^2.7.4"
  },
  "devDependencies": {
    "@blockly/dev-scripts": "^4.0.1",
    "@blockly/dev-tools": "^8.0.2",
    "@blockly/workspace-backpack": "^6.0.2",
    "blockly": "^11.1.1"
  },
  "peerDependencies": {
    "blockly": ">=11"
  },
  "publishConfig": {},
  "eslintConfig": {
    "extends": "@blockly/eslint-config"
  },
  "engines": {
    "node": ">=8.17.0"
  },
  "browserslist": [
    "defaults"
  ]
}

My index.js file is also shown below: image image image

As for a public demo, you can try cloning this branch and running npm i and npm start to test things out: https://github.com/changminbark/workspace-multiselect/tree/test-plugins

Let me know if you have any other questions. Thank you!

changminbark avatar Aug 03 '24 05:08 changminbark

It turns out that I'm able to replicate the bug inside the shadow-block-converter plugin demo page by updating the dependency on core Blockly from 11.0.0 to 11.1.1. Will investigate.

EDIT: The bug is also present in 11.1.0.

johnnesky avatar Aug 09 '24 19:08 johnnesky

I believe the bug was a side effect of: https://github.com/google/blockly/pull/8172

johnnesky avatar Aug 09 '24 20:08 johnnesky

If I revert the changes related to getFirstNonShadowBlock() in core/block.ts and core/gesture.ts from https://github.com/google/blockly/pull/8172/files then this issue is fixed. However, I don't know what the original purpose of these changes was, so I'll wait until someone else from the Blockly team weighs in. @BeksOmega ?

johnnesky avatar Aug 10 '24 03:08 johnnesky