Skip to content

feat(ui): unify page context menus (click + right-click) behind one shared action list (CM-2)#164

Merged
eliotlim merged 3 commits into
mainfrom
feat/cm2-unify-page-menus
Jul 14, 2026
Merged

feat(ui): unify page context menus (click + right-click) behind one shared action list (CM-2)#164
eliotlim merged 3 commits into
mainfrom
feat/cm2-unify-page-menus

Conversation

@eliotlim

Copy link
Copy Markdown
Owner

Summary

CM-2 collapses every page action surface — the sidebar/favorites/library-tree rows, the click-triggered "…" dropdown, and right-clicking the page body — behind one canonical action list (PageMenuItems in PageContextMenu.tsx). A surface prop selects the compact row set vs. the full page superset; a menu prop selects the Radix family (right-click context menu vs. click dropdown). The click "…" dropdown and the right-click page body now render an identical action set, and NavContextMenu is reduced to a thin trigger over the shared list.

This PR also folds in the pre-endorsed design-review fixes (Devon — CLEAR WITH NITS).

Before / After

Behaviour Before After
Right-click page body — before it showed only a compact, divergent subset (no full-width / panes / present / export / settings / trash-view); after it shows the same full superset as the "…" dropdown.
Compact, diverged from the dropdown.

Full superset, one shared list. Note distinct Archive icon on "Trash" (view) vs. destructive red "Move to trash".
"…" dropdown on the Home page — Rename / Copy link / Duplicate / Move to… now render disabled on Home, matching the PageActionsCluster toolbar (which treats Home as non-actionable). Add subpage / Add database stay enabled. Rename/Copy-link/Duplicate/Move-to were enabled on Home (guarded only by !id), inconsistent with the toolbar.
Four items greyed; Add subpage/database still live.
Menu extent at a short viewport n/a
Full superset ≈686px tall (see Operational note on finding #2).

Design-review fixes applied

  1. Home-page gating bug. Rename / Copy link / Duplicate / Move to… were guarded only by disabled={!id}, so on Home (non-null id) they rendered enabled — inconsistent with PageActionsCluster treating Home as non-actionable. Changed all four to disabled={!pageScoped} (pageScoped = !!id && !isHome). Add subpage / Add database intentionally stay !id-only (adding children under Home is legitimate). — PageContextMenu.tsx:268,272,276,280
  2. Distinct icon for "Trash (view)" vs "Move to trash". Both used Trash2; adjacent in the same surface, one navigational + one destructive = misclick risk. The nav.trash view item now uses lucide Archive, visually distinct from the destructive red Trash2. — PageContextMenu.tsx (import + nav.trash item)
  3. Cleanup. Pruned the now-dead menu.viewOptions i18n key across en/de/ja/zh (the old label header was dropped). Bumped the right-click ContextMenuContent width w-56 → w-60 to match the dropdown (same longest labels — avoids wrapping). — PageContextMenu.tsx, i18n/messages/*.ts

(Devon's deferred nit — "Settings / Trash-view feel app-level" — is a follow-up UX call, not in this PR.)

Testing

  • build:libs ✅ · ui typecheck ✅ · ui lint ✅ · ui vitest ✅ (112 files / 1053 tests)
  • Captures produced via the web e2e Playwright harness (throwaway spec, removed): asserted the four Home dropdown items carry aria-disabled="true" while Add subpage stays enabled, and that the after menu renders the full superset.

Operational

  • Chromatic re-baseline required: the page-menu snapshot legitimately changes (right-click body is now the full superset; Home items now disabled; Archive icon on view-Trash; width w-60). The reviewer should approve the CI Chromatic diff to re-baseline.
  • Finding Load workspace from filesystem #2 (menu overflow) result: the full page superset menu is ≈686px tall. On a viewport ≥ ~700px it fits with room to spare; at an artificially short 680px viewport the tail clips by a few px (Radix does not cap the menu height). This is pre-existing behaviour of the "…" dropdown (same content) — CM-2 simply brings it to the right-click surface too; not introduced here. Flagging for the record; not blocking. The compact row/before menu (≈380px) is unaffected.

Footer: verify green (build:libs / ui typecheck / ui lint / ui vitest). Gate: design (Devon — CLEAR WITH NITS, applied).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w

eliotlim and others added 2 commits July 14, 2026 11:30
…st (CM-2)

The click "…" dropdown (NavContextMenu) and the right-click page-body menu now
render a single canonical PageMenuItems list, so a page offers an identical
action set either way. PageMenuItems gains a `surface` ('row' vs 'page') and
`menu` ('context' vs 'dropdown') so the sidebar/favorites/library rows keep the
exact compact set/order they had, while the current-page surfaces render the
full superset through whichever Radix menu family hosts them.

- Add ContextMenuCheckboxItem primitive (full-width toggle in right-click menu).
- NavContextMenu keeps its dropdown shell + "Page actions" aria-label signal.
- Present is now conditional on doc (non-database) pages; export stays gated on
  registered exportKinds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
…design review)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
app.book.pub Ready Ready Preview, Comment Jul 14, 2026 4:56am

Request Review

…gression)

The unified page menu (CM-2) renders the full action superset from the "…"
dropdown and the right-click page body — ~18 items — which runs past the fold
on a normal viewport. DropdownMenuContent/ContextMenuContent used
overflow-hidden with no max-height, so the lower items (notably "Move to
trash") were painted off-screen and unclickable: Playwright reported the
destructive item "visible, enabled and stable" yet "outside of the viewport",
timing out delete.spec.ts. Bound both to --radix-*-content-available-height
with overflow-y-auto (matching popover/select), so the menu scrolls within the
viewport and every item stays reachable. Home-gating (pageScoped disabling) is
untouched and still correct.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
@eliotlim eliotlim merged commit 83ec4bd into main Jul 14, 2026
8 of 9 checks passed
@eliotlim eliotlim deleted the feat/cm2-unify-page-menus branch July 14, 2026 04:56
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