diff --git a/accessible/sidebar.component.js b/accessible/sidebar.component.js index 832f041d4..de5ba6ebc 100644 --- a/accessible/sidebar.component.js +++ b/accessible/sidebar.component.js @@ -90,6 +90,7 @@ blocklyApp.SidebarComponent = ng.core.Component({ }, clearWorkspace: function() { blocklyApp.workspace.clear(); + this.treeService.clearAllActiveDescs(); // The timeout is needed in order to give the blocks time to be cleared // from the workspace, and for the 'workspace is empty' button to show up. setTimeout(function() { diff --git a/accessible/tree.service.js b/accessible/tree.service.js index c928919c8..b1c51dbc4 100644 --- a/accessible/tree.service.js +++ b/accessible/tree.service.js @@ -214,6 +214,16 @@ blocklyApp.TreeService = ng.core.Class({ ' is invalid.'); } }, + clearAllActiveDescs: function() { + for (var treeId in this.activeDescendantIds_) { + var activeDesc = document.getElementById(this.getActiveDescId(treeId)); + if (activeDesc) { + activeDesc.classList.remove('blocklyActiveDescendant'); + } + } + + this.activeDescendantIds_ = {}; + }, isTreeRoot_: function(element) { return element.classList.contains('blocklyTree');