diff --git a/src/vs/workbench/browser/actions/navigationActions.ts b/src/vs/workbench/browser/actions/navigationActions.ts index d9d2323d6a69848bc94199b57183511f293f355c..22bae467a85586430da0899957166663bf600115 100644 --- a/src/vs/workbench/browser/actions/navigationActions.ts +++ b/src/vs/workbench/browser/actions/navigationActions.ts @@ -202,8 +202,9 @@ class NavigateDownAction extends BaseNavigationAction { } function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Parts, next: boolean): Parts { - const neighbour = part === Parts.EDITOR_PART ? (next ? Parts.STATUSBAR_PART : Parts.PANEL_PART) : part === Parts.STATUSBAR_PART ? (next ? Parts.SIDEBAR_PART : Parts.EDITOR_PART) : - part === Parts.SIDEBAR_PART ? (next ? Parts.PANEL_PART : Parts.STATUSBAR_PART) : part === Parts.PANEL_PART ? (next ? Parts.EDITOR_PART : Parts.SIDEBAR_PART) : Parts.EDITOR_PART; + const neighbour = part === Parts.EDITOR_PART ? (next ? Parts.STATUSBAR_PART : Parts.PANEL_PART) : part === Parts.STATUSBAR_PART ? (next ? Parts.ACTIVITYBAR_PART : Parts.EDITOR_PART) : + part === Parts.ACTIVITYBAR_PART ? (next ? Parts.SIDEBAR_PART : Parts.STATUSBAR_PART) : part === Parts.SIDEBAR_PART ? (next ? Parts.PANEL_PART : Parts.ACTIVITYBAR_PART) : + part === Parts.PANEL_PART ? (next ? Parts.EDITOR_PART : Parts.SIDEBAR_PART) : Parts.EDITOR_PART; if (layoutService.isVisible(neighbour) || neighbour === Parts.EDITOR_PART) { return neighbour; } @@ -212,8 +213,8 @@ function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Part } function focusNextOrPreviousPart(layoutService: IWorkbenchLayoutService, next: boolean): void { - const currentlyFocusedPart = layoutService.hasFocus(Parts.EDITOR_PART) ? Parts.EDITOR_PART : layoutService.hasFocus(Parts.STATUSBAR_PART) ? Parts.STATUSBAR_PART : - layoutService.hasFocus(Parts.SIDEBAR_PART) ? Parts.SIDEBAR_PART : layoutService.hasFocus(Parts.PANEL_PART) ? Parts.PANEL_PART : undefined; + const currentlyFocusedPart = layoutService.hasFocus(Parts.EDITOR_PART) ? Parts.EDITOR_PART : layoutService.hasFocus(Parts.ACTIVITYBAR_PART) ? Parts.ACTIVITYBAR_PART : + layoutService.hasFocus(Parts.STATUSBAR_PART) ? Parts.STATUSBAR_PART : layoutService.hasFocus(Parts.SIDEBAR_PART) ? Parts.SIDEBAR_PART : layoutService.hasFocus(Parts.PANEL_PART) ? Parts.PANEL_PART : undefined; let partToFocus = Parts.EDITOR_PART; if (currentlyFocusedPart) { partToFocus = findVisibleNeighbour(layoutService, currentlyFocusedPart, next); diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 715a0a9d1c166d5f3b28a068e9b74073a6a13dea..bb0d6570508c650a29d6f374d8b851e6ef4fd857 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -177,6 +177,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi private backupFileService!: IBackupFileService; private notificationService!: INotificationService; private themeService!: IThemeService; + private activityBarService!: IActivityBarService; protected readonly state = { fullscreen: false, @@ -260,8 +261,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this.viewDescriptorService = accessor.get(IViewDescriptorService); this.titleService = accessor.get(ITitleService); this.notificationService = accessor.get(INotificationService); + this.activityBarService = accessor.get(IActivityBarService); accessor.get(IStatusbarService); // not used, but called to ensure instantiated - accessor.get(IActivityBarService); // not used, but called to ensure instantiated // Listeners this.registerLayoutListeners(); @@ -846,6 +847,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi activeViewlet.focus(); } break; + case Parts.ACTIVITYBAR_PART: + this.activityBarService.focusActivityBar(); + break; default: // Status Bar, Activity Bar and Title Bar simply pass focus to container const container = this.getContainer(part); diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 0ffadfcdac9a00b63700160822c4bbfc488ec6b7..377942abb073bc2b2ad6b672a750179c64a164e3 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -168,6 +168,10 @@ export class ActivitybarPart extends Part implements IActivityBarService { this.registerListeners(); } + focusActivityBar(): void { + this.compositeBar.focus(); + } + private registerListeners(): void { // View Container Changes diff --git a/src/vs/workbench/browser/parts/compositeBar.ts b/src/vs/workbench/browser/parts/compositeBar.ts index b78760dbf663249a0ba2aad18c5c1a4b3cbd654e..72fa96f1ff544c999c64d044420ff5f728caf94f 100644 --- a/src/vs/workbench/browser/parts/compositeBar.ts +++ b/src/vs/workbench/browser/parts/compositeBar.ts @@ -253,6 +253,12 @@ export class CompositeBar extends Widget implements ICompositeBar { return actionBarDiv; } + focus(): void { + if (this.compositeSwitcherBar) { + this.compositeSwitcherBar.focus(); + } + } + layout(dimension: Dimension): void { this.dimension = dimension; if (dimension.height === 0 || dimension.width === 0) { diff --git a/src/vs/workbench/services/activityBar/browser/activityBarService.ts b/src/vs/workbench/services/activityBar/browser/activityBarService.ts index e42d22de53302e887e852e33db721470680906ab..dc76b07f76b09fb3e94d5d96493315f5f046098e 100644 --- a/src/vs/workbench/services/activityBar/browser/activityBarService.ts +++ b/src/vs/workbench/services/activityBar/browser/activityBarService.ts @@ -26,4 +26,9 @@ export interface IActivityBarService { * Returns id of visible viewlets following the visual order. */ getVisibleViewContainerIds(): string[]; + + /** + * Focuses the activity bar. + */ + focusActivityBar(): void; }