Add information about the surrounding parent to the block description, for context.

This commit is contained in:
Sean Lip
2016-09-23 18:33:59 -07:00
parent ea846abc9f
commit 09f25f618f
2 changed files with 13 additions and 4 deletions

View File

@@ -30,9 +30,9 @@ blocklyApp.ToolboxTreeComponent = ng.core
template: `
<li [id]="idMap['toolboxBlockRoot']" role="treeitem"
[ngClass]="{blocklyHasChildren: displayBlockMenu}"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['blockSummary'], 'blockly-toolbox-block')"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['toolboxBlockSummary'], 'blockly-toolbox-block')"
[attr.aria-level]="level">
<label #blockSummary [id]="idMap['blockSummary']">{{getBlockDescription()}}</label>
<label #toolboxBlockSummary [id]="idMap['toolboxBlockSummary']">{{getBlockDescription()}}</label>
<ol role="group" *ngIf="displayBlockMenu">
<li [id]="idMap['sendToSelected']" role="treeitem" *ngIf="!isWorkspaceEmpty()"
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['sendToSelectedButton'], 'blockly-button')"
@@ -73,7 +73,7 @@ blocklyApp.ToolboxTreeComponent = ng.core
this.utilsService = _utilsService;
}],
ngOnInit: function() {
var idKeys = ['toolboxBlockRoot', 'blockSummary'];
var idKeys = ['toolboxBlockRoot', 'toolboxBlockSummary'];
if (this.displayBlockMenu) {
idKeys = idKeys.concat([
'workspaceCopy', 'workspaceCopyButton', 'sendToSelected',

View File

@@ -115,7 +115,16 @@ blocklyApp.WorkspaceTreeComponent = ng.core
this.audioService = _audioService;
}],
getBlockDescription: function() {
return this.utilsService.getBlockDescription(this.block);
var blockDescription = this.utilsService.getBlockDescription(this.block);
var parentBlock = this.block.getSurroundParent();
if (parentBlock) {
var fullDescription = blockDescription + ' inside ' +
this.utilsService.getBlockDescription(parentBlock);
return fullDescription;
} else {
return blockDescription;
}
},
removeBlockAndSetFocus_: function(block, deleteBlockFunc) {
this.treeService.removeBlockAndSetFocus(