diff --git a/src/sql/workbench/browser/modelComponents/tree.component.ts b/src/sql/workbench/browser/modelComponents/tree.component.ts index 4736554125..6df0f2a92d 100644 --- a/src/sql/workbench/browser/modelComponents/tree.component.ts +++ b/src/sql/workbench/browser/modelComponents/tree.component.ts @@ -110,7 +110,7 @@ export default class TreeComponent extends ComponentBase { indentPixels: 10, twistiePixels: 20, - ariaLabel: 'Tree Node' + ariaLabel: this.ariaLabel }); this._tree.setInput(new Root()); this._tree.domFocus(); @@ -162,6 +162,13 @@ export default class TreeComponent extends ComponentBase if (this._treeRenderer) { this._treeRenderer.options.withCheckbox = this.withCheckbox; } + + if (this._tree) { + // If tree was already initialized, update its properties + if (this.ariaLabel) { + this._tree.ariaLabel = this.ariaLabel; + } + } } public get withCheckbox(): boolean { diff --git a/src/vs/base/parts/tree/browser/treeImpl.ts b/src/vs/base/parts/tree/browser/treeImpl.ts index 6adfc8774e..d6375a99c7 100644 --- a/src/vs/base/parts/tree/browser/treeImpl.ts +++ b/src/vs/base/parts/tree/browser/treeImpl.ts @@ -205,6 +205,13 @@ export class Tree implements _.ITree { getContentHeight(): number { return this.view.getContentHeight(); } + + /** + * Sets the `aria-label` attribute of the underlying root HTML element. + */ + public set ariaLabel(value: string) { + this.getHTMLElement().setAttribute('aria-label', value); + } // {{SQL CARBON EDIT}} - end block