Skip to content

module-diagrams: frame rendered diagrams like other content blocks, with open and share actions in the header #3397

Closed

Description

@schlessera

Problem

A rendered diagram (diagram content renderer, DiagramContent in packages/module-diagrams/src/ui.tsx:32-56) is a bare <figure>. The serif title sits on the chat background above the drawing, the drawing has its own inner border, and the actions sit in a separate row underneath: a large filled "Open diagram" Button and the share trigger (ui.tsx:49-52). Other framed content in the chat puts its title and actions in one header bar inside a frame:

  • the kit's CodeBlock has a header with a right-side action slot (packages/ui-kit/src/blocks/CodeBlock.tsx), used by brain-markdown-code.tsx:38;
  • the chat Mermaid block uses compact IconButtons ("Open diagram", "Share diagram") in its top-right corner (packages/ui-react/src/components/chat/mermaid-block.tsx:99-115).

So the diagram block looks unfinished next to them, and its large action button takes a full row.

Example: the Odysseus "Voyage record" diagram (Odysseus → RECORD → Voyage ledger) renders with "Open diagram" as a large filled button below the card and the share icon beside it.

Approach

Frame the rendered diagram like the other content blocks:

  • an outer frame with the same border, radius and surface tokens as CodeBlock;
  • a header row inside the frame with the title on the left and the actions on the right: open/zoom and share as compact icon buttons, consistent with the Mermaid block and the kit's header-action pattern, with accessible names unchanged ("Open diagram", "Share diagram");
  • the drawing (or its narrow/summary fallback) in the frame body, with no doubled inner border.

Reuse the existing kit pieces (CodeBlock's header pattern or a shared frame primitive if one exists; IconButton) rather than adding module-local styling. If a shared "framed block with header actions" primitive is missing and two blocks now need it, extracting it into ui-kit is in scope.

Acceptance criteria

  • A rendered diagram shows one frame, with its title and the open/share actions in a header row: title left, actions right.
  • Actions are compact icon buttons with unchanged accessible names and at least 44×44 touch targets on coarse pointers. They stay keyboard reachable and keep visible focus.
  • Layout holds at 320 px and 1280 px in light and dark: the title truncates or wraps without pushing the actions out, and nothing overflows.
  • Print and share output are unchanged. The print drawing still replaces the interactive one, and the header actions are hidden in print.
  • The zoom viewer and share menu behave exactly as before.
  • Visual review screenshots (320/1280 × light/dark) are attached to the PR, and the existing diagram browser/layout tests pass, updated only where the frame legitimately moved controls.

Part of #2079.

Activity

  1. added this to the 0.45.0 milestone on Nov 2, 2026
  2. added
    type: featA new capability or a change in user-visible behaviour.
    area: modulesFirst-party content modules and the module seam.
    area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 2, 2026
  3. self-assigned this
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claiming (claim-3397-664522). Branch feat/3397-diagram-frame from epic/2079-module-renderers (d1e1f3a). Collision check on the cited files: closure-level overlaps only (module-diagrams/ui-react/ui-kit workspaces shared with many open PRs), no direct path collisions.

  5. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Implementation is up for review in #3410 (base epic/2079-module-renderers @ d1e1f3a, head dcc7539), marked ready, milestone 0.45.0. This issue closes when the epic batch lands on main. Local proof: check:pr passed; pinned-image browsers green (diagrams chromium+webkit 268/268, pointer fine/coarse/mixed 480/480); share-mode markup byte-identical; three mutation receipts. Follow-up re-audit of the diagram browser-document pins: #3405.

  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Delivered to epic/2079-module-renderers as 74008eadc via #3410, after ready-candidate proof passed on the exact epic base. This issue closes when the epic batch lands on main.

  7. removed their assignment
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: modulesFirst-party content modules and the module seam.area: ui-kitThe presentational design kit: components, tokens, Storybook, visual baselines.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions