support aria-expand for actions (#11869)

* support aria-expand for actions

* update text
This commit is contained in:
Alan Ren
2020-08-19 14:18:52 -07:00
committed by GitHub
parent 3c538d1c2d
commit a3ae2df0ce
5 changed files with 52 additions and 3 deletions

View File

@@ -71,6 +71,11 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
if (event.tooltip !== undefined) {
this.updateTooltip();
}
// {{SQL CARBON EDIT}}
if (event.expanded !== undefined) {
this.updateExpanded();
}
}
get actionRunner(): IActionRunner {
@@ -197,6 +202,11 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
// implement in subclass
}
// {{SQL CARBON EDIT}}
protected updateExpanded(): void {
// implement in subclass
}
dispose(): void {
if (this.element) {
DOM.removeNode(this.element);
@@ -348,6 +358,17 @@ export class ActionViewItem extends BaseActionViewItem {
}
}
}
// {{SQL CARBON EDIT}}
updateExpanded(): void {
if (this.label) {
if (this.getAction().expanded !== undefined) {
this.label.setAttribute('aria-expanded', `${this.getAction().expanded}`);
} else {
this.label.removeAttribute('aria-expanded');
}
}
}
}
export class SelectActionViewItem extends BaseActionViewItem {