@remotion/web-renderer: Fix scaffold scroll regression#6740
@remotion/web-renderer: Fix scaffold scroll regression#6740samohovets wants to merge 1 commit intomainfrom
@remotion/web-renderer: Fix scaffold scroll regression#6740Conversation
|
Cursor Agent can help with this pull request. Just |
@remotion/web-renderer: Fix scaffold scroll regression
There was a problem hiding this comment.
The wrapper approach is correct — position: fixed; overflow: hidden prevents the composition's dimensions from expanding the document's scroll area. One minor comment about a stale code comment.
|
|
||
| const div = document.createElement('div'); | ||
|
|
||
| // Match same behavior as in portal-node.ts |
There was a problem hiding this comment.
This comment ("Match same behavior as in portal-node.ts") is now misleading. packages/core/src/portal-node.ts uses a fixed container offset to top: -999999px with an absolute child spanning the container via right: 0; bottom: 0; width: 100%; height: 100%. The scaffold's approach is structurally similar (fixed wrapper + absolute child) but the styling intent is different — explicit pixel dimensions, visibility: hidden, overflow: hidden. Consider updating or removing this comment to avoid confusion for future maintainers.

Fix:
renderMediaOnWeb()scroll regressionThis PR addresses a regression where
renderMediaOnWeb()could make the host page scrollable due to the scaffold node's dimensions.Why this change?
Previously, the scaffold's fixed element with explicit composition
width/heightcould expand thedocument.bodyordocumentElementscroll area. This change prevents unintended scrollability of the host page during rendering.What changed?
position: fixed; inset: 0; overflow: hidden; visibility: hidden; pointer-events: none; z-index: -9999wrapper is now appended todocument.body.position: absolute; top: 0; left: 0;child inside this wrapper, with itswidth/heightset from the composition.render-media.test.tsxasserts thatdocument.documentElementanddocument.bodyscroll dimensions do not increase during or after arenderMediaOnWeb()call.How it works:
The new fullscreen fixed wrapper effectively isolates the composition's layout from the main document's scroll area. By setting
overflow: hiddenon the wrapper, any content within (including large compositions) is clipped, preventing it from influencing the host page's scroll dimensions.Test Evidence:
packages/web-renderer/src/test/render-media.test.tsx(including the new scroll regression test) passed in Chromium.packages/web-renderer/src/test/render-still.test.tsxalso passed, verifying shared scaffold path behavior.Edge Cases/Tradeoffs: