提交 542d6738 编写于 作者: B Benjamin Pasero

actionbar: no tabindex if no action

上级 0a62fc83
......@@ -368,6 +368,7 @@ export interface IActionItemProvider {
export interface IActionBarOptions {
orientation?:ActionsOrientation;
context?:any;
disableTabIndex?:boolean;
actionItemProvider?:IActionItemProvider;
actionRunner?:actions.IActionRunner;
}
......@@ -424,7 +425,6 @@ export class ActionBar extends Events.EventEmitter implements actions.IActionRun
this.domNode = document.createElement('div');
this.domNode.className = 'monaco-action-bar';
this.domNode.tabIndex = 0;
var isVertical = this.options.orientation === ActionsOrientation.VERTICAL;
......@@ -546,6 +546,10 @@ export class ActionBar extends Events.EventEmitter implements actions.IActionRun
this.actionsList.insertBefore(actionItemElement, this.actionsList.children[index++]);
}
if (!this.options.disableTabIndex && !this.domNode.hasAttribute('tabIndex')) {
this.domNode.tabIndex = 0; // make sure an action bar with actions participates in tab navigation
}
this.items.push(item);
});
}
......@@ -556,6 +560,10 @@ export class ActionBar extends Events.EventEmitter implements actions.IActionRun
item.dispose();
}
$(this.actionsList).empty();
if (!this.options.disableTabIndex) {
this.domNode.removeAttribute('tabIndex'); // empty action bar does not participate in tab navigation
}
}
public length():number {
......
......@@ -108,7 +108,7 @@ export class ActivitybarPart extends Part implements IActivityService {
this.createViewletSwitcher($result.clone());
// Bottom Toolbar with action items for global actions
this.createGlobalToolBarArea($result.clone());
// this.createGlobalToolBarArea($result.clone()); // not used currently
return $result;
}
......@@ -117,9 +117,9 @@ export class ActivitybarPart extends Part implements IActivityService {
// Viewlet switcher is on top
this.viewletSwitcherBar = new ActionBar(div, {
actionItemProvider: (action: Action) => this.activityActionItems[action.id]
actionItemProvider: (action: Action) => this.activityActionItems[action.id],
disableTabIndex: true // we handle this
});
this.viewletSwitcherBar.getContainer().removeAttribute('tabindex');
this.viewletSwitcherBar.getContainer().addClass('position-top');
// Build Viewlet Actions in correct order
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册