Skip to content

Commit ff0dfa3

Browse files
colin-grant-worksgraband
authored andcommitted
Don't focus window for reveal widget call (#15760)
1 parent dbd2df7 commit ff0dfa3

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

packages/core/src/browser/secondary-window-handler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,8 @@ export class SecondaryWindowHandler {
190190
const trackedWidget = this._widgets.find(w => w.id === widgetId);
191191
if (trackedWidget && this.getFocusedWindow()) {
192192
this.secondaryWindowService.focus(trackedWidget.secondaryWindow!);
193-
return trackedWidget;
194193
}
195-
return undefined;
194+
return trackedWidget;
196195
}
197196

198197
getFocusedWindow(): Window | undefined {

packages/core/src/browser/shell/application-shell.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,16 +1358,20 @@ export class ApplicationShell extends Widget {
13581358
widget = this.rightPanelHandler.activate(id);
13591359
}
13601360
if (widget) {
1361-
// If this application has focus, then on widget activation, activate the window.
1362-
// If this application does not have focus, do not routinely steal focus.
1363-
if (this.secondaryWindowHandler.getFocusedWindow()) {
1364-
this.windowService.focus();
1365-
}
1361+
this.focusWindowIfApplicationFocused();
13661362
return widget;
13671363
}
13681364
return this.secondaryWindowHandler.activateWidget(id);
13691365
}
13701366

1367+
protected focusWindowIfApplicationFocused(): void {
1368+
// If this application has focus, then on widget activation, activate the window.
1369+
// If this application does not have focus, do not routinely steal focus.
1370+
if (this.secondaryWindowHandler.getFocusedWindow()) {
1371+
this.windowService.focus();
1372+
}
1373+
}
1374+
13711375
/**
13721376
* Focus is taken by a widget through the `onActivateRequest` method. It is up to the
13731377
* widget implementation which DOM element will get the focus. The default implementation
@@ -1467,7 +1471,7 @@ export class ApplicationShell extends Widget {
14671471
widget = this.rightPanelHandler.expand(id);
14681472
}
14691473
if (widget) {
1470-
this.windowService.focus();
1474+
this.focusWindowIfApplicationFocused();
14711475
return widget;
14721476
} else {
14731477
return this.secondaryWindowHandler.revealWidget(id);

0 commit comments

Comments
 (0)