Skip to content

fix(drawio): restore heading styles inside Graph foreignObjects#30

Merged
MrCoder merged 1 commit intomainfrom
fix/drawio-textbox-heading-bold
May 3, 2026
Merged

fix(drawio): restore heading styles inside Graph foreignObjects#30
MrCoder merged 1 commit intomainfrom
fix/drawio-textbox-heading-bold

Conversation

@MrCoder
Copy link
Copy Markdown
Contributor

@MrCoder MrCoder commented May 3, 2026

Summary

DrawIO Textbox shapes were rendering <h1>Heading</h1> indistinguishably from surrounding <p> body text — same 12px Helvetica regular weight, no margin gap. Reproduced on prod Confluence (Full Graph Smoke Test 2026) and locally via the graph-view sandbox.

Root cause

Tailwind's preflight ships this rule globally:

h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit }
blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre { margin: 0 }

DrawIO renders authored HTML inside SVG <foreignObject> elements and relies on UA defaults for heading semantics. The preflight wipes those defaults, so <h1> collapses to inherited body styling.

Fix

src/components/Viewer/GenericViewer.vue — added a non-scoped <style> block that uses font-size: revert; font-weight: revert; margin: revert for h1–h6, p, blockquote inside .screen-capture-content foreignObject. Narrow scope means it only affects diagram canvas content, not the rest of the app.

Permanent local repro

Added cell id=7 (textbox with <h1>Heading</h1><p>Lorem ipsum…</p>) to src/model/Ap/MockedResponse/custom-content-by-id-v1-diagram-graph.json. Visit http://127.0.0.1:8080/index.html?sandbox=graph-view&outputType=display after pnpm start:local.

Verification

  • Computed styles after fix: h1 → fontSize 24px, fontWeight 700, margin 16.08px 0 (was 12px / 400 / 0)
  • Existing AWS-icon Playwright regression test (viewer-preview-graph-aws-icons.spec.ts) still passes against the updated fixture
  • GenericViewer.spec.ts (9 tests) passes
  • Lint clean, lite build passes

Test plan

  • CI staging E2E green
  • On a staging Confluence page, view a Graph macro with a Textbox shape — heading renders bold/larger
  • PNG export of the same diagram preserves the heading style

🤖 Generated with Claude Code

Tailwind's preflight resets h1-h6 to font-size: inherit; font-weight: inherit and zeros heading/paragraph margins, which clobbered DrawIO Textbox shapes whose HTML payload (e.g. <h1>Heading</h1><p>...</p>) relies on UA defaults to render the heading in bold/larger text. Restore UA defaults inside .screen-capture-content foreignObject only, keeping the rest of the app on the Tailwind reset. Adds a textbox cell to the local graph fixture for permanent visual repro.
@MrCoder MrCoder temporarily deployed to staging-lite May 3, 2026 23:12 — with GitHub Actions Inactive
@MrCoder MrCoder merged commit 3140180 into main May 3, 2026
16 of 22 checks passed
@MrCoder MrCoder deleted the fix/drawio-textbox-heading-bold branch May 3, 2026 23:21
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