Skip to content

[Component Audit] ContextMenu: make pointer and touch evidence trustworthy - #7691

Merged
cixzhang merged 4 commits into
mainfrom
night-watch-component-audit/ContextMenu/2026-10-19
Oct 19, 2026
Merged

cixzhang merged 4 commits into
mainfrom
night-watch-component-audit/ContextMenu/2026-10-19

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Developers can now trust ContextMenu's docs and browser evidence: the docs describe the two mutually exclusive content modes, and the review story opens the pointer menu at its real trigger instead of at page origin. The exact-head evidence covers pointer and touch presentations across themes, RTL, selectable states, and narrow screens without changing component runtime behavior or public API.

Audit result

  • Package/component: core/ContextMenu
  • Audited base: 4d200b246cd04f35399afd13f1d15bd596437bbf
  • Exact head: bcb6130def046671741c9216258018ba5cb2144c
  • Mode: Night Watch whole-component audit
  • Rubric: 1.16.6
  • Before: 80.0 / C, one open BLOCK; §5b rendered design was not measured
  • After: 82.5 / C, one open BLOCK
  • Sensitivity: fixing the retained BLOCK with no other score change removes the grade cap; projected score remains 82.5 / B

Current authority applied: architecture:component-theming-surface, architecture:interaction-modality, architecture:layer-runtime, architecture:public-component-api, family:overlay-dismissal, spec:AST-020, plus WCAG 2.2 A/AA. component:ContextMenu is draft and is used as observational context only.

Findings and remediations

  • BLOCK · §4 behavior / architecture:interaction-modality INV4: a long press can open the menu and then close it as the finger lifts, removing the touch path. The separate objective fix is #7308; this audit does not duplicate it.
  • FIX · §4 behavior / module:DropdownMenu/useMenuPress AR1 and FR2: a pointer-opened menu focuses and highlights the first row before the pointer moves. The separate objective fix is #7303; this audit does not duplicate it.
  • FIXED · §8 docs / architecture:public-component-api consumer-doc projection: ContextMenu.doc.mjs marked items unconditionally required even though the public TypeScript union requires exactly one of items and menuContent. Both entries now state the exclusive choice; the [docs] Changeset publishes the correction.
  • FIXED · §6 testing / objective evidence integrity: the pointer story dispatched coordinates relative to the page rather than the trigger, so the menu appeared at page origin. It now computes trigger-relative coordinates. The audit test uses real Playwright right-clicks and verifies the menu's left edge at the pointer in LTR and right edge at the pointer in RTL.

Component audit score

Section Before After Evidence
§1 Accessibility 4.0 4.0 Named menu/dialog surfaces, keyboard path, focus return, disabled/selectable semantics; axe 0
§2 Theming 4.5 4.5 Owned context-menu surfaces; Neutral and Butter light/dark frames
§3 Public API 4.5 4.5 Released subpath, refs, passthrough, discriminated content modes
§4 Behavior 3.0 3.0 Retained long-press BLOCK and pointer-open FIX; both have separate objective PRs
§5a Objective design 4.5 4.5 Tokens, logical layout, delegated row/sheet ownership
§5b Rendered design not measured 4.5 18 exact-head Chromium frames reviewed
§6 Testing 4.0 4.5 Real pointer coordinates, semantic/state assertions, fail-closed receipts
§7 Code health 4.0 4.0 No production code changed; existing lifecycle remains readable
§8 Docs 4.0 4.5 Exclusive content-mode guidance corrected and released
§9 i18n & RTL 4.0 4.5 RTL CI passed; pointer alignment flips to the correct inline edge
§10 Responsive & touch 3.0 3.0 320px frames pass without overflow; retained long-press BLOCK remains

Exact-head browser evidence

CI run · 18-frame artifact

  • 18/18 screenshots and sensor receipts passed at bcb6130.
  • Neutral and Butter; light/dark; LTR/RTL; 1024×768 and 320×720.
  • Pointer menu, disabled row, sections, checkbox/radio rows, BottomSheet, inline trigger, and scroll-container trigger.
  • Every receipt binds repository and Storybook SHA, story, mode, direction, theme, viewport, rendered surface semantics, geometry, fonts, reduced motion, page errors, horizontal overflow, and pointer placement where applicable.
  • Component-scoped axe: 17 stories, 0 violations, 0 new baseline entries.
  • RTL, stable visual, CLA, lint, typecheck, package, registry, docsite, unit, and integration checks are required to finish green on this same head before merge.

FR5 evidence inventory

The closed inventory starts from ContextMenu/index.ts, the discriminated data/compound types, consumer docs, source branches, tests, and stories. It covers:

  1. Data and compound content modes; action, divider, section, checkbox, radio, and submenu entries.
  2. Pointer, BottomSheet, and adaptive presentations; right-click, keyboard context-menu, and long-press invocation.
  3. Disabled behavior, inline/block triggers, custom width/size, cursor anchoring, scroll-container clipping, dismissal, and focus return.
  4. The context-menu target on pointer/touch surfaces and delegated DropdownMenu, BottomSheet, and List ownership.
  5. Default/custom labels, i18n, RTL edge alignment, narrow reflow, and touch reachability.

Equivalent DropdownMenu/List/BottomSheet-owned rendering is delegated to those component owners rather than rescored as ContextMenu implementation. The retained long-press and pointer-open gaps are explicit above; no inventory row disappears because it is unresolved.

Needs Review

No new product decision is introduced. The retained findings already have separate objective fixes. The draft component record remains non-authoritative and is not amended by this audit.

FR10 eligibility report

{
  "version": 1,
  "component": "core/ContextMenu",
  "mode": "nightly",
  "rubricVersion": "1.16.6",
  "repositoryBase": "4d200b246cd04f35399afd13f1d15bd596437bbf",
  "repositoryHead": "bcb6130def046671741c9216258018ba5cb2144c",
  "componentContract": {"id": "component:ContextMenu", "authority": "draft", "backfillInThisPr": false},
  "inventory": {"closed": true, "renderedFrames": 18, "axeViolations": 0},
  "remediations": [
    {"id": "exclusive-content-mode-doc", "kind": "doc-drift", "evidence": ["public TypeScript union", "doc tests", "Changeset"]},
    {"id": "trigger-relative-story", "kind": "evidence-fix", "evidence": ["real right-click frames", "LTR/RTL pointer-edge assertions"]}
  ],
  "unresolved": {"objective": ["#7303", "#7308"], "manual": []},
  "approvals": {"specOwner": "success; no knowledge records changed", "privateExactHeadSelfReview": "clean after PR-body refresh"},
  "checks": "exact-head CI running; merge only when every context is green",
  "verdict": "manual-merge-eligible-when-green",
  "reasons": ["spec:AST-029 FR11 auto-merge inactive", "one retained pre-existing BLOCK does not worsen in this PR"]
}

Scope and verification

  • One primary intent: whole-component audit evidence plus objective docs/evidence corrections.
  • Existing behavior fixes remain in their own pull requests.
  • No component runtime, public API, default, compatibility promise, or subjective visual direction changes.
  • Public text and artifacts contain no private context.
  • Focused ContextMenu and doc tests: 82/82 pass.
  • Core/docs/Storybook typechecks, build, strict lint, knowledge, changeset, sync, i18n, package-boundary, and fixture checks pass locally or on exact-head CI.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 19, 2026
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 19, 2026 11:15am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 19, 2026, 11:08 AM UTC

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@cixzhang
cixzhang force-pushed the night-watch-component-audit/ContextMenu/2026-10-19 branch from 303c6e9 to 40140f0 Compare October 19, 2026 10:53
@cixzhang
cixzhang merged commit 9b8b723 into main Oct 19, 2026
52 of 53 checks passed
@cixzhang
cixzhang deleted the night-watch-component-audit/ContextMenu/2026-10-19 branch October 19, 2026 12:17

This branch was successfully deployed

1 active deployment
Preview — bcb6130d Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant