disable blockly orphan connection logic#11201
Merged
Conversation
srietkerk
approved these changes
Mar 19, 2026
Member
|
Oh wow, I never noticed this blockly "feature" before... very un-intuitive. I can see container blocks wrapping around existing blocks, but not for inputs/inline blocks. Thanks for making this change Richard. I wonder if we should also give Blockly some feedback on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes microsoft/pxt-arcade#7370
also mentioned on the forum here: https://forum.makecode.com/t/list-variable-persists-when-covered-with-another-block/42747
not that i actually needed this to be reported, because it annoys me ALL THE TIME, but i never fixed it because this isn't actually a bug but rather an intentional blockly feature.
when a block is dragged into an input that already has a non-shadow block connected, blockly has some logic that checks to see if the block you just dragged has a single input and, if so, connects the previously connected block to the input of the block you just dragged. presumably this is to make it easier to wrap blocks with a new block (for example, dragging an absolute value block onto a number in an equation will wrap it theoretically saving you an extra drag). however, nobody ever expects this behavior and only the most powerful of power users would use it to their advantage. it also can cause type errors when the displaced block is a variable since variables can be connected to any input regardless of what type they actually hold. it's better to just disable it entirely.
behavior before:

behavior after:

unfortunately, there's no graceful way to disable this so i had to monkey patch
if you want to look at the original code that's being patched, it's here