LearnNewsExamplesConnect
Frontmatter
assigneesneo-gpt-euclid
createdAtAug 28, 2026, 10:18 AM
updatedAtAug 28, 2026, 12:36 PM
githubUrlhttps://github.com/neomjs/neo/issues/17826
authorneo-gpt-euclid
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[x] 17824 Honor offsets and point targets in floating alignment, [x] 17825 Dismiss floating menus and pickers on outside pointers
blocking[]
closedAtAug 28, 2026, 12:36 PM

Add a real-pointer context-menu example and proof

Closed v13.2.0/archive-v13-2-0-chunk-16 documentationenhancementdeveloper-experienceaitesting
neo-gpt-euclid
neo-gpt-euclid commented on Aug 28, 2026, 10:18 AM

Context

Neo has inline Menu examples and a Button-owned floating menu example, but no permanent example for the common application pattern: open a floating menu from onContextMenu at the pointer coordinate. No Engine whitebox journey covers real right-click input, nested menu focus, outside-pointer dismissal, or viewport-edge placement.

A temporary complete Body example proved why the missing example matters:

  • center placement through direct fixed left/top was exact;
  • near (1260,700) in a 1280×720 viewport, the menu overflowed to right=1361.63, bottom=789;
  • real nested submenu clicks were green on this machine, while a downstream report observed a load-sensitive root unmount;
  • non-focusable outside clicks left both Menu and Picker open because focus did not move.

The permanent example is the consumer proof for the alignment and floating-dismissal prerequisites, not a place to reimplement them.

The Problem

Developers currently have to infer five non-obvious pieces from unrelated sources: contextmenu default prevention, reusable Menu construction, pointer geometry, floating alignment, and focus/dismissal lifecycle. The predictable result is application-root listeners, direct coordinate styles, removed parentComponent links, synthetic-click false greens, and business-app-specific fixes.

The Architectural Reality

  • examples/menu/ is the canonical Body example family. A complete examples/menu/context/ app matches the existing list/ and panel/ structure.
  • The example consumes serialized point alignment from #17824 and pointer-complete Menu dismissal from #17825.
  • Context menus are not Button menus: they have no persistent trigger component. The pointer point is the alignment target, and the Menu's own outside-pointer contract owns dismissal.
  • Whitebox E2E belongs at test/playwright/e2e/rendering/ContextMenuNL.spec.mjs, beside ButtonBaseNL.spec.mjs.
  • Physical behavior must use real Playwright mouse input. Synthetic click/contextmenu dispatch does not prove browser focus transitions.

The Fix

Add a small, public examples/menu/context/ application:

  • one non-focusable workspace region and one naturally focusable item;
  • onContextMenu creates/reuses one floating Neo.menu.List with nested and leaf actions;
  • native context-menu default is prevented on the example surface;
  • the Menu aligns to {x: clientX, y: clientY, width: 0, height: 0} with edgeAlign: 't0-b0', axisLock: true, and viewport constraint;
  • a visible status component records the selected leaf action without business-domain logic.

Add a whitebox journey that drives the real browser and asserts both rendered and worker truth.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback / Edge Case Docs Evidence
New examples/menu/context/ This ticket + existing Menu examples Teach the minimal reusable right-click Menu pattern No application root listener or direct left/top fallback Example JSDoc and visible instructions Browser + Neural Link journey
Pointer placement #17824 Open at the pointer and stay fully inside the viewport through flip/constrain Reopen at a new point updates the same Menu instance Example code Center + four-edge geometry assertions
Menu lifecycle #17825 Nested real clicks stay open; leaf, Escape, focusable outside, and non-focusable outside paths settle correctly No wall-clock sleeps as correctness assertions Example code Worker state + activeElement + DOM presence
Real-input evidence Whitebox E2E protocol Use page.mouse right/left clicks and keyboard Escape, then assert Engine state via Neural Link Synthetic event dispatch is not accepted as the only positive path Spec comments only Exact custom E2E command

Decision Record impact

none — this adds a canonical consumer and executable documentation for existing Engine components.

Acceptance Criteria

  • Complete Body example exists under examples/menu/context/ and passes the examples Body-only/build guards.
  • Real right-click opens one reusable Menu at the pointer; the native browser menu is suppressed only on the example surface.
  • Center placement is exact, and top/right/bottom/left edge probes keep the full Menu inside the viewport using alignment flip/constrain.
  • Real first- and second-level submenu clicks keep the full menu tree mounted and focus the intended item.
  • A leaf action updates worker-owned example state and dismisses according to Menu policy.
  • Escape, focusable outside click, and non-focusable outside click dismiss; inside clicks do not.
  • Reopening at a different point reuses the Menu instance and updates geometry without stale submenus or listeners.
  • Whitebox proof asserts App-worker component state plus DOM/focus geometry; no synthetic-only positive path and no blind correctness sleep.

Out of Scope

  • Business permissions, editor commands, occurrence search, delete-key behavior, or any downstream application code.
  • A context-menu framework subclass, application controller scaffold, guide archaeology, or multiple demo variants.
  • Touch long-press, OS-native menus, or custom animation design.
  • Fixing alignment or dismissal inside the example PR; it consumes the prerequisite contracts.

Avoided Traps

  • Copying the downstream workaround: would publish application ownership for framework behavior.
  • Synthetic-click proof: misses the exact real-focus failure class.
  • Oversized studio demo: obscures the reusable menu contract behind product code.

Related

Live latest-open sweep: checked the latest 20 open issues plus exact context-menu / right-click / example / whitebox searches at 2026-08-28T08:17:48Z; no equivalent found beyond prerequisites #17824 and #17825 created in this lane. A2A all-status recency sweep: 30 messages; no competing claim.

Origin Session ID: d893ccaa-a773-4796-a67c-748667ab2563

Retrieval Hint: "examples menu context real right click nonfocusable outside submenu viewport edge whitebox"

tobiu cross-referenced by PR #17827 on Aug 28, 2026, 10:52 AM
tobiu cross-referenced by PR #17828 on Aug 28, 2026, 11:15 AM
tobiu referenced in commit ae40344 - "feat(menu): add real-pointer context-menu example (#17826) (#17829)" on Aug 28, 2026, 12:36 PM
tobiu closed this issue on Aug 28, 2026, 12:36 PM