Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/core/src/browser/secondary-window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ export class SecondaryWindowHandler {
const trackedWidget = this._widgets.find(w => w.id === widgetId);
if (trackedWidget && this.getFocusedWindow()) {
this.secondaryWindowService.focus(trackedWidget.secondaryWindow!);
return trackedWidget;
}
return undefined;
return trackedWidget;
}

getFocusedWindow(): Window | undefined {
Expand Down
16 changes: 10 additions & 6 deletions packages/core/src/browser/shell/application-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1358,16 +1358,20 @@ export class ApplicationShell extends Widget {
widget = this.rightPanelHandler.activate(id);
}
if (widget) {
// If this application has focus, then on widget activation, activate the window.
// If this application does not have focus, do not routinely steal focus.
if (this.secondaryWindowHandler.getFocusedWindow()) {
this.windowService.focus();
}
this.focusWindowIfApplicationFocused();
return widget;
}
return this.secondaryWindowHandler.activateWidget(id);
}

protected focusWindowIfApplicationFocused(): void {
// If this application has focus, then on widget activation, activate the window.
// If this application does not have focus, do not routinely steal focus.
if (this.secondaryWindowHandler.getFocusedWindow()) {
this.windowService.focus();
}
}

/**
* Focus is taken by a widget through the `onActivateRequest` method. It is up to the
* widget implementation which DOM element will get the focus. The default implementation
Expand Down Expand Up @@ -1467,7 +1471,7 @@ export class ApplicationShell extends Widget {
widget = this.rightPanelHandler.expand(id);
}
if (widget) {
this.windowService.focus();
this.focusWindowIfApplicationFocused();
return widget;
} else {
return this.secondaryWindowHandler.revealWidget(id);
Expand Down
Loading