Skip to content

fix(menu): position the context menu with gpui-base Positioner - #566

Merged
Tryanks merged 1 commit into
mainfrom
fix/context-menu-positioner
Oct 1, 2026
Merged

Tryanks merged 1 commit into
mainfrom
fix/context-menu-positioner

Conversation

@Tryanks

@Tryanks Tryanks commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Changed behaviour

ContextMenu placed its menu with GPUI's raw anchored().snap_to_window_with_margin(px(8.)). It now uses gpui_base::Positioner::corner, the same corner-anchoring base's own Popup uses, so a context menu is clamped into the viewport the same way every other popup is — including the frame insets of a client-decorated window, which anchored ignored — and occludes what it covers like base popups do. The 8px margin matches base Popup's window margin, which base keeps private; the comment says so.

Per Principle 7 as extended in #564.

Tests

New context_menu_opens_at_the_pointer_and_stays_in_the_window: the contract from #285 (menu top-left at the right-click point; clamped to the window margin near an edge) now has a test, so the primitive swap and future ones are checked against it. Existing long_press_dismissal_consumes_outside_tap and the Markdown link context-menu tests still pass.

Checks run

  • cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo nextest run -p tcode-ui --locked — all passed

Not verified visually (no Accessibility/Screen Recording permission for the computer-use tools on this machine); placement is asserted by the new test.

Positioner::corner clamps into the viewport the way base's own Popup
does, including the frame insets of a client-decorated window, which
anchored().snap_to_window_with_margin did not.
@Tryanks
Tryanks merged commit c929afa into main Oct 1, 2026
13 of 14 checks passed
@Tryanks
Tryanks deleted the fix/context-menu-positioner branch October 1, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant