Commit 66d31c3
authored
Fix env-select popup placement on narrow windows and dismissal on blur (#1037)
* Keep the env-select popup on screen and dismiss it on window blur
On a narrow window the 600px popup was positioned by subtracting its width
and padding from the title bar width, which goes negative once the window
approaches its 400px minimum. The popup then rendered clipped off the left
edge with its search box unreachable, so clamp the left coordinate to zero.
The popup also lingered when the window lost OS focus, since the blur
handler only deactivated the title bar. Because the popup is a child view
of the same window, focusing it does not blur the window, so a blur only
fires on a real focus loss such as Alt-Tab, which is exactly when the popup
should close. Hide it from that handler.
I built and verified this with Claude Code, checking the clamp against a
unit test that reproduces the off-screen coordinate on a 400px window.
* fix: cap the env popup width to the window so nothing is clipped
Clamping only the x moved the clipping from the left edge to the right, so on a
narrow window the search box became reachable but the config button and the
environment names were cut off. The popup is a fixed 600px while the window
minWidth is 400, so it can never fit at that size by position alone.
Cap the popup width to the space between the left edge and its right anchor
instead. The popup content is responsive, so it reflows to fit and the whole
thing stays on screen. Verified on a built app at a 470px window: the popup
renders fully inside the window (x 0, width 437), with the search box, the
config button and the full environment list all visible. Caught the earlier
clamp-only version by looking at a before/after screenshot with Claude Code.1 parent e050646 commit 66d31c3
2 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
| |||
1356 | 1357 | | |
1357 | 1358 | | |
1358 | 1359 | | |
1359 | | - | |
1360 | 1360 | | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
1361 | 1367 | | |
1362 | 1368 | | |
1363 | 1369 | | |
1364 | 1370 | | |
1365 | 1371 | | |
1366 | 1372 | | |
1367 | 1373 | | |
1368 | | - | |
| 1374 | + | |
1369 | 1375 | | |
1370 | | - | |
| 1376 | + | |
1371 | 1377 | | |
1372 | 1378 | | |
1373 | 1379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments