From ab042d4dd86b9a9c4d629f5b9c8e104a70f33f02 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Fri, 3 Mar 2017 16:15:02 -0800 Subject: [PATCH] Fix bug #904 by explicitly grabbing focus on the workspace svg element. (#964) --- core/workspace_svg.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 4945a60b7..0d68216f9 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1358,6 +1358,10 @@ Blockly.WorkspaceSvg.prototype.markFocused = function() { this.options.parentWorkspace.markFocused(); } else { Blockly.mainWorkspace = this; + // We call e.preventDefault in many event handlers which means we + // need to explicitly grab focus (e.g from a textarea) because + // the browser will not do it for us. + this.getParentSvg().focus(); } };