Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/blockly/core/dragging/block_drag_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export class BlockDragStrategy implements IDragStrategy {

if (this.moveMode === MoveMode.CONSTRAINED) {
showUnconstrainedMoveHint(this.workspace, true);
this.workspace.getAudioManager().playErrorBeep();
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions packages/blockly/core/workspace_audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ export class WorkspaceAudio {
oscillator.stop(this.context.currentTime + duration);
}

/**
* Plays a standard error beep.
*/
async playErrorBeep() {
return this.beep(260);
}

/**
* Returns whether or not playing sounds is currently allowed.
*
Expand Down
3 changes: 3 additions & 0 deletions packages/blockly/tests/mocha/keyboard_movement_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ suite('Keyboard-driven movement', function () {
suite('in constrained mode', function () {
test('prompts to use unconstrained mode when no destinations are available', function () {
const toastSpy = sinon.spy(Blockly.Toast, 'show');
const beepSpy = sinon.spy(this.workspace.getAudioManager(), 'beep');
Blockly.getFocusManager().focusNode(this.element);
const originalBounds = this.element.getBoundingRectangle();
startMove(this.workspace);
Expand All @@ -547,6 +548,8 @@ suite('Keyboard-driven movement', function () {
? 'Hold ⌘ Command and use arrow keys to move freely, then Enter to accept the position'
: 'Hold Ctrl and use arrow keys to move freely, then Enter to accept the position',
);
sinon.assert.calledOnce(beepSpy);
beepSpy.restore();
toastSpy.restore();
});

Expand Down
Loading