You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(app): context menus get cropped when opened near the bottom edge #44
Right-clicking near the bottom of the window opens the terminal context menu partly off-screen: Copy, Paste and Select all show, but Find… is cut off. The tab context menu has the same flaw.
Cause
Both menus clamp their position with a hard-coded height guess instead of the menu's real height:
The real height depends on line-height, button padding, <hr> margins and DPI scaling. When it exceeds the guess, the bottom runs past the window edge. Nothing else clips it: no ancestor sets transform, filter or contain, so position: fixed is relative to the viewport. The width clamp (- 164) has the same weakness.
Proposed solution
Measure the rendered menu and clamp with its real size, in both components:
Keep the existing bind:this={menu}.
After mount (and when x/y change), read menu.offsetWidth and menu.offsetHeight into $state.
Derive the position from them:
left = max(4, min(x, innerWidth - w - 4))
top = max(4, min(y, innerHeight - h - 4))
Render the menu with visibility: hidden until measured, so it does not flash at the unclamped position.
Optional: flip the menu above the cursor when there is not enough room below. Clamping is simpler and matches current behavior.
Acceptance criteria
Right-clicking at the very bottom and right edges of the window shows every menu item fully, for the terminal menu and the tab menu.
Holds at 100%, 125% and 150% display scaling.
Menu position is unchanged when there is enough room.
A shared helper for the clamp is fine if both components use it; a test covers the clamp logic.
Activity