mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Refactor how activeDescendant is set. Introduce helper functions to ensure that calls like pasteAbove() preserve the focus.
This commit is contained in:
@@ -48,9 +48,10 @@ blocklyApp.WorkspaceComponent = ng.core
|
||||
<div *ngIf="workspace">
|
||||
<ol #tree *ngFor="#block of workspace.topBlocks_; #i = index"
|
||||
tabIndex="0" role="group" class="blocklyTree blocklyWorkspaceTree"
|
||||
[attr.aria-activedescendant]="getActiveDescId(tree.id)"
|
||||
[attr.aria-labelledby]="workspaceTitle.id"
|
||||
(keydown)="onKeypress($event, tree)">
|
||||
<blockly-workspace-tree [level]=1 [block]="block" [tree]="tree">
|
||||
<blockly-workspace-tree [level]=1 [block]="block" [tree]="tree" [isTopLevel]="true">
|
||||
</blockly-workspace-tree>
|
||||
</ol>
|
||||
</div>
|
||||
@@ -74,6 +75,9 @@ blocklyApp.WorkspaceComponent = ng.core
|
||||
clearWorkspace: function() {
|
||||
this.workspace.clear();
|
||||
},
|
||||
getActiveDescId: function(tree) {
|
||||
return this.treeService.getActiveDescId(tree.id);
|
||||
},
|
||||
onWorkspaceToolbarKeypress: function(e) {
|
||||
this.treeService.onWorkspaceToolbarKeypress(
|
||||
e, document.activeElement.id);
|
||||
|
||||
Reference in New Issue
Block a user