add role on toggelMore action element (#11975)

* add role on toggelMore action element

* add aria-haspopup

* Fix localization and more descriptive

* single localized constant

Co-authored-by: Vasu Bhog <vabhog@microsoft.com>
This commit is contained in:
Maddy
2020-09-03 21:37:39 -07:00
committed by GitHub
parent 787245b058
commit a57379be49

View File

@@ -20,6 +20,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces'; import { MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
const moreActionsLabel = localize('moreActionsLabel', "More");
export class EditCellAction extends ToggleableAction { export class EditCellAction extends ToggleableAction {
// Constants // Constants
@@ -151,10 +152,11 @@ export class CellToggleMoreActions {
public onInit(elementRef: HTMLElement, context: CellContext) { public onInit(elementRef: HTMLElement, context: CellContext) {
this._moreActionsElement = elementRef; this._moreActionsElement = elementRef;
this._moreActionsElement.setAttribute('aria-haspopup', 'menu');
if (this._moreActionsElement.childNodes.length > 0) { if (this._moreActionsElement.childNodes.length > 0) {
this._moreActionsElement.removeChild(this._moreActionsElement.childNodes[0]); this._moreActionsElement.removeChild(this._moreActionsElement.childNodes[0]);
} }
this._moreActions = new ActionBar(this._moreActionsElement, { orientation: ActionsOrientation.VERTICAL }); this._moreActions = new ActionBar(this._moreActionsElement, { orientation: ActionsOrientation.VERTICAL, ariaLabel: moreActionsLabel });
this._moreActions.context = { target: this._moreActionsElement }; this._moreActions.context = { target: this._moreActionsElement };
let validActions = this._actions.filter(a => a instanceof Separator || a instanceof CellActionBase && a.canRun(context)); let validActions = this._actions.filter(a => a instanceof Separator || a instanceof CellActionBase && a.canRun(context));
removeDuplicatedAndStartingSeparators(validActions); removeDuplicatedAndStartingSeparators(validActions);
@@ -343,7 +345,7 @@ export class CollapseCellAction extends CellActionBase {
export class ToggleMoreActions extends Action { export class ToggleMoreActions extends Action {
private static readonly ID = 'toggleMore'; private static readonly ID = 'toggleMore';
private static readonly LABEL = localize('toggleMore', "Toggle More"); private static readonly LABEL = moreActionsLabel;
private static readonly ICON = 'masked-icon more'; private static readonly ICON = 'masked-icon more';
constructor( constructor(