Skip to content

Expand Mermaid diagrams into a lightbox on click#151

Merged
HamptonMakes merged 1 commit into
block:mainfrom
jwils:joshuaw/mermaid-lightbox
Jul 17, 2026
Merged

Expand Mermaid diagrams into a lightbox on click#151
HamptonMakes merged 1 commit into
block:mainfrom
jwils:joshuaw/mermaid-lightbox

Conversation

@jwils

@jwils jwils commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Why

Mermaid diagrams render constrained to the content column, so anything beyond a trivial flowchart is too small to read.

What

  • Clicking a rendered diagram (or the expand button that appears on hover) opens it in a native <dialog> sized to the viewport, with the SVG scaled to fit
  • Click anywhere or press Escape to close; the dialog is removed on close and tagged data-turbo-temporary so Turbo never caches it
  • Extend the foreignObject line-height fix (Fix clipped mermaid node labels by pinning label line-height #149) to the lightbox, which lives outside .markdown-rendered
  • System spec covering expand and click-to-close

Risk Assessment

Low — additive UI behavior scoped to rendered Mermaid diagrams; no server-side changes.

Screenshots

Inline diagram with the expand affordance on hover:

Hover expand button

Clicking opens the lightbox, scaled to the viewport:

Expanded lightbox

For comparison, the same diagram inline before expanding:

Inline diagram

Diagrams are constrained to the content column width, which makes
larger flowcharts too small to read. Clicking a rendered diagram now
opens it in a full-viewport dialog; click anywhere or press Escape
to close.
@jwils
jwils marked this pull request as ready for review July 17, 2026 19:40
@jwils
jwils requested a review from HamptonMakes as a code owner July 17, 2026 19:40
@HamptonMakes

Copy link
Copy Markdown
Collaborator

Please write system specs for this!

@HamptonMakes
HamptonMakes merged commit 73ee5a6 into block:main Jul 17, 2026
4 checks passed
HamptonMakes added a commit that referenced this pull request Jul 20, 2026
…resh

Prefer this branch's visibility model while genuinely adopting main's new
features:

- LinkPreviews/Slack unfurls (#154): adopted; context now speaks the
  visibility language — Private/Archived flagged, published unmarked,
  never "Draft". plan_og_description delegates to the same builder.
- Mermaid comment anchors (#148/#149/#151): adopted; mermaid-settled
  re-highlighting wired into our no-tabs plan page, anchors-updated
  re-anchoring wired into our headless comment nav. Clicking a comment
  mark inside a diagram now opens its thread popover instead of the
  lightbox (showModal force-hides popovers).
- Landing refresh + agent-instructions view (#140): adopted; step copy
  and mock badge updated to the born-published model (type badge, no
  status badge).
- Status badge menu (#146): superseded — visibility is the only state,
  toggled by the header eye; status_menu_controller removed.
- Attachments dropzone (#147): superseded by our add-modal dropzone;
  spec selectors reconciled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants