Skip to content

fix(app): context menus get cropped when opened near the bottom edge #44

Closed

Description

@arifintahu

Problem

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:

  • packages/app/src/terminal/TermMenu.svelte: Math.min(y, window.innerHeight - 140)
  • packages/app/src/chrome/TabMenu.svelte: Math.min(y, window.innerHeight - 180)

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:

  1. Keep the existing bind:this={menu}.
  2. After mount (and when x/y change), read menu.offsetWidth and menu.offsetHeight into $state.
  3. Derive the position from them:
    • left = max(4, min(x, innerWidth - w - 4))
    • top = max(4, min(y, innerHeight - h - 4))
  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

  1. added
    bug
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions