fix: prevent viewport-height units from causing canvas rendering issues#148
Merged
tristan-mouchet merged 4 commits intodevelopfrom Apr 10, 2026
Merged
fix: prevent viewport-height units from causing canvas rendering issues#148tristan-mouchet merged 4 commits intodevelopfrom
tristan-mouchet merged 4 commits intodevelopfrom
Conversation
- Derive viewport widths from BREAKPOINTS config to avoid sitting on exact breakpoint boundaries where CSS zoom rounding toggles styles - Measure iframe content by temporarily setting body/html height to auto instead of resizing the wrapper (avoids viewport shifts) - Disconnect ResizeObserver during measurement to prevent feedback loops from temporary style changes - Preserve current zoom mode (fit/autofit/custom) when switching viewport breakpoints instead of forcing autofit
lunenas
approved these changes
Apr 10, 2026
…anvas component - Refactored the logic for determining the final iframe height to ensure it fills the canvas correctly at various zoom levels. - Updated comments for clarity on behavior when zooming in, out, or switching viewports. - Adjusted the className for the container to include vertical centering with `my-auto`.
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
Viewport-height CSS units (vh, svh, dvh, lvh) caused a feedback loop on the canvas and preview: the iframe expanded to fit content, layers using these units grew with it, inflating the measured height indefinitely.
This also caused blank space in the preview when switching zoom modes or breakpoints.
Changes
updateViewportOverridesutility that injects CSS overriding viewport-height classes (h-screen, h-dvh, h-[100vh], etc.) with fixed pixel values based on a reference viewport heightmeasureContentExtentutility that measures actual child bounds instead of relying on scrollHeight (which inflates from h-full)Test plan