From 82fbcd6663e09a420e024931c99cb0cbc064e9ee Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 18 May 2026 09:58:56 -0700 Subject: [PATCH] fix: Beep when attempting to move past a dead end (#9890) --- .../core/dragging/block_drag_strategy.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/blockly/core/dragging/block_drag_strategy.ts b/packages/blockly/core/dragging/block_drag_strategy.ts index d5d892aaa..ea5cadc7d 100644 --- a/packages/blockly/core/dragging/block_drag_strategy.ts +++ b/packages/blockly/core/dragging/block_drag_strategy.ts @@ -484,6 +484,9 @@ export class BlockDragStrategy implements IDragStrategy { if (this.moveMode === MoveMode.UNCONSTRAINED) { this.block.moveDuringDrag(newLoc); } + + const wasConnected = !!this.connectionCandidate; + this.updateConnectionPreview( this.block, Coordinate.difference(newLoc, this.startLoc!), @@ -526,12 +529,15 @@ export class BlockDragStrategy implements IDragStrategy { // No connection was available or adequately close to the dragged block; // suggest using unconstrained mode to arbitrarily position the block if // we're in keyboard-driven constrained mode. - if ( - this.moveMode === MoveMode.CONSTRAINED && - !this.allConnectionPairs.length - ) { - showUnconstrainedMoveHint(this.workspace, true); - this.workspace.getAudioManager().playErrorBeep(); + if (this.moveMode === MoveMode.CONSTRAINED) { + if (!this.allConnectionPairs.length) { + showUnconstrainedMoveHint(this.workspace, true); + } + + if (!wasConnected) { + this.workspace.getAudioManager().playErrorBeep(); + } + return; } } this.announceMove();