Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/blockly/core/dragging/block_drag_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,19 @@ export class BlockDragStrategy implements IDragStrategy {
return this.pairToCandidate(parentPair);
}

// Fall back to the nearest parent block that has a compatible connection.
// This handles the case where a nested value block (e.g. a number input)
// has passive focus but the dragged block is a statement block that should
// be inserted after the containing statement block.
let parentBlock = passiveBlock.getSurroundParent();
while (parentBlock) {
const pair = this.allConnectionPairs.find(
(pair) => pair.neighbour.getSourceBlock() === parentBlock,
);
if (pair) return this.pairToCandidate(pair);
parentBlock = parentBlock.getSurroundParent();
}

return null;
}

Expand Down