@@ -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