Skip to content

fix: unify shared menu positioning#121

Merged
DeadWaveWave merged 4 commits intomainfrom
fix/shared-menus
Mar 30, 2026
Merged

fix: unify shared menu positioning#121
DeadWaveWave merged 4 commits intomainfrom
fix/shared-menus

Conversation

@DeadWaveWave
Copy link
Copy Markdown
Owner

@DeadWaveWave DeadWaveWave commented Mar 30, 2026

💡 Change Scope

  • Small Change: Fast feedback, localized UI/logic, low-risk.
  • Large Change: New feature, cross-boundary logic, runtime-risk (persistence, IPC, lifecycle, recovery).

📝 What Does This PR Do?

This PR fixes the menu offset drift affecting task prompt templates, task agent sessions, and other shared menu surfaces by converging them on a reusable viewport menu primitive.

Instead of letting each feature compute fixed positioning inside whatever transformed container it lives in, menus that should anchor to viewport coordinates now render through a shared surface portaled to document.body, with shared placement, clamping, and flip behavior. The canvas context menu family stays compatible and reuses the shared placement helpers where it made sense without forcing oversized file churn.

Regression coverage was added for the shared placement helper and the affected user flows.


🏗️ Large Change Spec (Required if "Large Change" is checked)

1. Context & Business Logic

The bug class was structural: several menus were mixing viewport-based coordinates with local/transformed render trees, so their overlays drifted away from the trigger location. The desired business behavior is consistent menu placement regardless of the local container transform or scroll state.

2. State Ownership & Invariants

  • Feature components still own menu open state, trigger refs, and action semantics; the shared layer only owns viewport placement and dismissal mechanics.
  • Menus anchored by viewport coordinates must render outside transformed/local layout containers so their measured position matches the user-visible viewport.
  • Placement must remain inside the viewport via shared clamp/flip rules, and dismiss behavior must not immediately close when interacting with the originating trigger.

3. Verification Plan & Regression Layer

  • Unit: shared workspace menu helper coverage for anchor/placement behavior.
  • E2E: prompt templates menu positioning, task agent session menu flow, and related shared menu surfaces (space archives, workspace/sidebar menu flows).
  • Full gate: pnpm pre-commit.

✅ Delivery & Compliance Checklist

  • My code passes the ultimate gatekeeper: pnpm pre-commit is completely green.
  • I have included new tests to lock down the behavior (or explicitly stated why it's untestable).
  • I have strictly adhered to the DEVELOPMENT.md architectural boundaries.
  • I have attached a screenshot or screen recording (if this touches the UI).
  • I have updated the documentation accordingly (if adding a feature or changing a contract).

📸 Screenshots / Visual Evidence

Per repo convention, PR screenshots should be uploaded directly in the GitHub PR UI rather than committed into the repository. Visual regression coverage is provided by the added Playwright flows for prompt templates, task agent session menus, and related shared menu surfaces.

@DeadWaveWave DeadWaveWave merged commit ccde99a into main Mar 30, 2026
3 checks passed
@DeadWaveWave DeadWaveWave deleted the fix/shared-menus branch March 30, 2026 09:11
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