fix(drawio): restore heading styles inside Graph foreignObjects#30
Merged
fix(drawio): restore heading styles inside Graph foreignObjects#30
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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 usesfont-size: revert; font-weight: revert; margin: revertforh1–h6, p, blockquoteinside.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>) tosrc/model/Ap/MockedResponse/custom-content-by-id-v1-diagram-graph.json. Visithttp://127.0.0.1:8080/index.html?sandbox=graph-view&outputType=displayafterpnpm start:local.Verification
h1 → fontSize 24px, fontWeight 700, margin 16.08px 0(was 12px / 400 / 0)viewer-preview-graph-aws-icons.spec.ts) still passes against the updated fixtureGenericViewer.spec.ts(9 tests) passesTest plan
🤖 Generated with Claude Code