Thanks to visit codestin.com
Credit goes to github.com

Skip to content

@remotion/web-renderer: Fix scaffold scroll regression#6740

Draft
samohovets wants to merge 1 commit intomainfrom
cursor/scaffold-scroll-regression-7b9b
Draft

@remotion/web-renderer: Fix scaffold scroll regression#6740
samohovets wants to merge 1 commit intomainfrom
cursor/scaffold-scroll-regression-7b9b

Conversation

@samohovets
Copy link
Member

@samohovets samohovets commented Feb 28, 2026

Fix: renderMediaOnWeb() scroll regression

This 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/height could expand the document.body or documentElement scroll area. This change prevents unintended scrollability of the host page during rendering.

What changed?

  1. Scaffold mounting strategy:
    • A new position: fixed; inset: 0; overflow: hidden; visibility: hidden; pointer-events: none; z-index: -9999 wrapper is now appended to document.body.
    • The composition root (the actual rendering target) is mounted as an position: absolute; top: 0; left: 0; child inside this wrapper, with its width/height set from the composition.
  2. Cleanup: The cleanup process now correctly removes both the outer wrapper and the inner composition root, in addition to unmounting the React root and cleaning up CSS.
  3. Regression Test: A new test in render-media.test.tsx asserts that document.documentElement and document.body scroll dimensions do not increase during or after a renderMediaOnWeb() 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: hidden on 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.tsx also passed, verifying shared scaffold path behavior.

Edge Cases/Tradeoffs:

  • Preserves existing APIs and backward compatibility.
  • Handles compositions larger than the viewport without affecting page scroll.
  • Ensures robust cleanup of all DOM nodes.

@cursor
Copy link

cursor bot commented Feb 28, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link
Contributor

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Feb 28, 2026 9:01pm
remotion Building Building Preview, Comment Feb 28, 2026 9:01pm

Request Review

@samohovets samohovets changed the title Scaffold scroll regression @remotion/web-renderer: Fix scaffold scroll regression Feb 28, 2026
@samohovets
Copy link
Member Author

@pullfrog

Copy link
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow runpullfrog.com𝕏


const div = document.createElement('div');

// Match same behavior as in portal-node.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants