PlotDirector/Docs/PWA/Context-Menus.md
Nick Beckley e48889ac05 Complete desktop workspaces, context menus and plot health
Commit the pending application, help and browser regression work. Pin the patched PKCS dependency for the production release.
2026-10-31 09:27:04 +00:00

12 KiB

Installed desktop context menus — V2

Shared command surface

application-context-menu.js uses the established PlotDirectorPwa.standalone state. A normal browser event returns untouched. Ctrl+right-click returns before any target processing or preventDefault; touch context events are not mapped to this desktop feature. Ordinary PWA right-click is owned consistently, even when there is no useful actionable menu.

Components declare data-pd-context, an object ID/label where available, and optionally a bounded command scope. The nearest component owns the target. Only that component's rendered controls are considered; nested objects are excluded. Timeline chapters restrict discovery to their immediate title region rather than scanning all scene cards. No network/database work is needed to open a menu and no global card discovery pass is performed.

The ribbon's shared PlotDirectorCommands adapter exposes its existing semantic identity, icon lookup and original-control invocation. Context menus deduplicate scoped operations and invoke the original anchor/button, retaining server/Razor permission decisions, live disabled state, hidden form fields, antiforgery, subscriptions, confirmations and existing handlers. They do not construct archive/delete POSTs or independently infer permissions. Controls in a form requiring field input are deliberately left to that workflow. Dynamic source removal closes the menu, and command execution rechecks that the source remains connected/enabled.

An object is bound when right-clicked; previous scene/map selection is never used to choose its commands. Opening a menu does not synthesize primary clicks, start drags or introduce multi-selection. Selecting an existing Inspect/Select command performs its normal selection behavior. Object menus stay bound to that object; unrelated current-page edits are not appended to an object menu. Background actions are drawn only from useful current contextual ribbon controls and current create/edit/settings commands, not the complete global ribbon. Exports, jumps and secondary actions use one submenu level. Limits keep rare/secondary operations compact; all original UI remains accessible.

Editing and accessibility

Text/search inputs and textareas offer Cut, Copy, Paste and Select All with applicable disabled states. Clipboard access uses secure navigator.clipboard APIs; denied access is caught and announces the normal keyboard alternative. No credential or clipboard content is logged. Cut/paste preserve the captured range, emit cancellable beforeinput plus normal input/change events, respect current read-only/disabled state and maximum length, and abandon an asynchronous edit if focus/value changed. Password Cut/Copy are excluded; input types without a selection-range API keep unsupported clipboard operations disabled, with Ctrl+right-click/native keyboard editing available. Readable selected text offers Copy/Select All without adding editing clutter to unselected cards.

Menus use the existing theme tokens and SVG catalog (plus semantic editing icons), compact rows, destructive styling, ARIA menus/menuitems/separators, named submenu state and visible keyboard focus. Shift+F10/Context Menu key opens at the focused component; arrows/Home/End, Enter/Space, submenu Right/Left, Escape and Tab are supported. Focus returns to the originating control on dismissal/execution. Mouse and keyboard submenus flip left and clamp vertically at viewport edges. Click-away, another right-click, scroll outside the menu, context changes, resize, blur and navigation dismiss menus.

Coverage inventory

Commands below are conditional on the original rendered UI; no missing/forbidden operation is manufactured.

Context / audited area Useful commands and semantic owners / deliberate limits
Project gallery, Overview Project cards expose existing Open/Edit/Archive; archived project cards use their existing Restore/delete-dialog triggers. Overview background uses current Project ribbon/context commands. Counts/activity summaries are content, not new object commands.
Project restore points, Activity, Collaborators Restore-point rows reuse Download and Restore/Delete dialog triggers, not their modal submit buttons. Activity remains readable evidence; collaborator invitation/removal stays in its existing management UI (a right-clicked control can still invoke itself). No new sharing operation.
Book cards and Overview Book cards reuse Open/Edit/Archive. Chapter rows reuse Open/Edit/Archive. Background uses Book ribbon and page actions. Import/analysis/manuscript-link lifecycle is unchanged.
Chapters / scene lists Chapter task header reuses Edit, workflow, Add Scene, brief and Archive. Scene rows reuse Timeline/Edit, existing ordering buttons and Archive with their original IDs/confirmations. Bulk POV form remains local.
Timeline Scene cards invoke their own existing inspector/focus route. Chapter context offers its Chapter Details link; that title is also a conventional discoverable link. Scene overview inspector context invokes its existing Edit Details modal. Page menus reuse existing Settings/create/validation/navigation commands. No new move/duplicate/archive operation is manufactured on a card which did not expose it. No Plot Line lanes are reintroduced.
Calendar Day navigation keeps its normal links; selected/unplaced scene cards reuse Open Scene/Timeline. Calendar query/date controls remain local.
Plot Lines narrative map Scene callouts reuse Inspect Scene; tray scenes reuse their own selection-for-association command. Line labels reuse Edit Colour, health inspection and Add Selected Scene when available. Inspector action row reuses Open Scene/Writer. Health markers can invoke their own existing inspection control. Association and direct-drop workflows stay unchanged.
Plot line / thread management Rows reuse Edit, Focus scenes, Add Thread and Archive, as available. Thread boundaries/plot-event evidence with no existing action remain evidence; no invented event mutation.
At This Point Scene header reuses Open Scene/Timeline/Calendar, asset/thread rows reuse their editor/source-scene links. Coupled book/chapter/scene selectors remain local and never imply a previous target.
Review Centre / review observations Module tiles use their currently rendered review/view/retry controls. Locked tiles gain no review/retry capability. Observation cards reuse Review This Observation only where already offered. Decisions/reasons/gated analysis remain in their normal workflows.
Scenarios Cards reuse Open Timeline/Compare/Archive. Sandbox scene cards reuse their own Move Up/Down forms; destination selection stays local. Apply Scenario keeps its existing confirmation. No cross-over into main manuscript chronology.
Continuity Evidence rows reuse their own Timeline/source-scene route. Coupled investigation filters and analytical cards stay local; no invented continuity resolutions.
Characters Cards reuse Open/Edit/Archive; detail header reuses its existing edit/merge/reanalyse/export/archive controls and navigation. Reanalyse keeps the original running/disabled state. No analysis is launched during verification.
Relationships / Dynamics Relationship-list items reuse Select Relationship; existing Arc/Knowledge/relationship links and page commands remain available. SVG graph geometry and chart points with no separately exposed operation receive only appropriate page context. No invented graph editing or relationship mutation.
World / Locations / Story Assets Location tree rows and asset cards reuse Open/Edit/Archive. Detail headers reuse their normal navigation/merge/export/management actions. Reparenting, dependencies and custody fields remain in their own forms.
Floor plans List objects reuse Open Editor and the existing Delete dialog trigger. Canvas blocks/geometry retain existing tools; no new block mutation API.
Story Bible Character/thread/asset/location cards reuse their exact existing profile/editor/focused-Timeline links. Background reuses scoped exports and section jumps. Relationship aggregates/read-only summaries are not given speculative edit actions.
Metrics / Health / Warnings Metric rows reuse existing order/Edit/activate/remove controls where fieldless and available. Warnings reuse item navigation and supported original controls; reason/choice forms stay local. Health charts/counts are analytical content, with only existing page validation/navigation context.
Archive Archived objects expose only original Restore/Delete Forever commands, including typed permanent-delete confirmation. Active-object edit/association commands are not synthesized.
Writer / schedules Plan rows reuse existing View Schedule/Edit/activate/deactivate/regenerate/delete controls. Planning fields and coupled schedule operations remain local. The external Word manuscript workflow is unchanged; no manuscript editor is introduced.
Help / imports / feedback / account / security Existing focused controls and useful page actions; readable selection and normal editable fields get editing commands. Credentials/recovery data gain no domain shortcuts and are excluded from screenshots. No feedback is sent by verification.
Empty workspace / application chrome A small relevant current-page menu, the right-clicked control itself, or no actionable presentation. Native browser menu is still suppressed only in desktop PWA; Ctrl+right-click remains the deliberate fallback.

Normal browser pages, existing visible commands, mobile long-press and Production remain unchanged. Help describes right-click and the advanced Ctrl override.

Verification — 30 October 2026

  • Solution build and Release publish pass; all 374 executable regressions pass. Existing unrelated dependency advisories are unchanged.
  • Focused installed-PWA suite passes: untouched browser/Ctrl events (including inputs/buttons), a physical right-click, Shift+F10/Context Menu key, A/B scene routing, original archive and typed permanent-delete confirmation, disabled buttons/fieldsets, archived/read-only contexts, real Cut/Copy/Paste/Select All, clipboard denial, submenu mouse/keyboard operation, all four viewport corners including scrollbar clearance, all six current themes, 1440/900 widths and dismissal/source lifecycle. Original scene click and drag attributes remain intact.
  • The 20 actual Razor view desktop suite passes with six themes at 2560/1440/900, representative menu captures, semantic command reuse, original forms/permissions/confirmations, responsive/collapsed ribbon, fragment replacement and search. First-paint cold/navigation/reload guards continue to measure 0 px of activation movement.
  • Authenticated live Dev verification passes on the existing 42-route browser/installed-PWA suite, now checking native/Ctrl/menu behavior on each route. Additional owned-data checks exercise two real scene targets, chapter edit, character/location/asset/plot-line/thread routes, character detail, sandbox and relationship pages, original archive cancellation, map inspection, Association-mode scene selection and real clipboard access. No association or manuscript edit is saved by these checks. Review Centre/gated review coverage uses actual rendered fixtures; no Story Intelligence run is started.
  • Menus are composed synchronously without network/database requests. Final live samples: 30 opens, 1.56 ms mean / 2.8 ms maximum on this host. These are observed local timings, not a universal performance guarantee.
  • Visually inspected menu treatment in all six current themes, narrow desktop, left-opening submenus, editing/read-only/disabled/destructive states and representative page contexts. The coverage table records deliberate non-actions and field-dependent workflows left in place.
  • Dev release: 340c5e3-pwa-context-v2-worktree-20261030T163622Z. Published/deployed DLL and served menu JS/CSS/shared-adapter hashes match. Service active, local/public GET 200, no warning/error service entries during final verification.
  • The dedicated Dev identity used normal authentication. Its sample project (imported using the normal preview/acknowledgement/confirmation flow), books/scenes/entities and sandbox were removed through the normal complete account-deletion workflow; the private credential file is deleted. Production is untouched.