From 7a456a048bda58bf7235a27c28b6a9a6e96be154 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Wed, 16 Jun 2021 17:51:36 +0000 Subject: [PATCH] Prevent an error beep when copying blocks in Safari. --- core/shortcut_items.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/shortcut_items.js b/core/shortcut_items.js index 352d829c5..ef1cb07fc 100644 --- a/core/shortcut_items.js +++ b/core/shortcut_items.js @@ -99,7 +99,10 @@ Blockly.ShortcutItems.registerCopy = function() { Blockly.selected.isDeletable() && Blockly.selected.isMovable(); }, - callback: function() { + callback: function(workspace, e) { + // Prevent the default copy behavior, which may beep or otherwise indicate + // an error due to the lack of a selection. + e.preventDefault(); Blockly.hideChaff(); Blockly.copy(/** @type {!Blockly.ICopyable} */ (Blockly.selected)); return true;