Fix font-size inheritance in HTML artifact iframes

Set explicit font-size: 16px on the <html> element in sandboxed iframes
to prevent browser default inheritance quirks that can cause unexpected
font sizes (e.g., 75% shown in devtools).

This establishes a consistent base font size while still allowing user
HTML content to override it on body or specific elements as needed.

Fixes the issue where HTML artifacts displayed with inconsistent font
sizes due to iframe inheritance behavior.
This commit is contained in:
Mario Zechner 2025-10-11 18:46:55 +02:00
parent b5648eaabd
commit 2a67556e5d

View file

@ -495,7 +495,12 @@ export class SandboxIframe extends LitElement {
})
.join("\n");
return `<script>
return `<style>
html {
font-size: 16px;
}
</style>
<script>
window.sandboxId = ${JSON.stringify(sandboxId)};
${dataInjection}
${bridgeCode}