@@ -182,6 +182,7 @@ export class SessionWindow implements IDisposable {
182182 } ) ;
183183 this . _window . on ( 'blur' , ( ) => {
184184 titleBarView . deactivate ( ) ;
185+ this . _hideEnvSelectPopup ( ) ;
185186 } ) ;
186187
187188 titleBarView . load ( ) ;
@@ -1367,18 +1368,23 @@ export class SessionWindow implements IDisposable {
13671368 }
13681369
13691370 const titleBarRect = this . _titleBarView . view . getBounds ( ) ;
1370- const popupWidth = 600 ;
13711371 const paddingRight = process . platform === 'darwin' ? 33 : 127 ;
1372+ // Anchor the popup's right edge near the env button and cap its width to
1373+ // what fits, so on a narrow window it shrinks (the popup content is
1374+ // responsive) instead of hanging off an edge with the search box or the
1375+ // env list clipped.
1376+ const rightEdge = titleBarRect . width - paddingRight ;
1377+ const popupWidth = Math . min ( 600 , rightEdge ) ;
13721378 // shorten browser view height if larger than max allowed
13731379 const maxHeight = Math . min (
13741380 this . _envSelectPopup . getScrollHeight ( ) ,
13751381 defaultEnvSelectPopupHeight
13761382 ) ;
13771383
13781384 this . _envSelectPopup . view . view . setBounds ( {
1379- x : Math . round ( titleBarRect . width - paddingRight - popupWidth ) ,
1385+ x : Math . round ( rightEdge - popupWidth ) ,
13801386 y : Math . round ( titleBarRect . height ) ,
1381- width : popupWidth ,
1387+ width : Math . round ( popupWidth ) ,
13821388 height : Math . round ( maxHeight )
13831389 } ) ;
13841390 }
0 commit comments