Skip to content

Commit fdf9ffa

Browse files
fix(engine): preserve nested sibling video layout (#3639)
1 parent 1acc65d commit fdf9ffa

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎packages/engine/src/services/screenshotService.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,23 @@ describe("video-frame injection respects ancestor visibility", () => {
518518
expect(seededImg.style.visibility).toBe("hidden");
519519
});
520520

521+
it("preserves display:none on an inactive in-flow video so its sibling keeps the same box", async () => {
522+
const { teardown, setup } = withGlobals(setupHostHiddenScenario({}));
523+
setup.video.style.display = "none";
524+
const seededImg = setup.document.createElement("img");
525+
seededImg.classList.add("__render_frame__");
526+
setup.video.parentNode?.insertBefore(seededImg, setup.video.nextSibling);
527+
528+
try {
529+
await syncVideoFrameVisibility(passthroughPage(), []);
530+
} finally {
531+
teardown();
532+
}
533+
534+
expect(setup.video.style.display).toBe("none");
535+
expect(seededImg.style.visibility).toBe("hidden");
536+
});
537+
521538
it("still injects when a plain [data-start] host is visibility:hidden (CSS-escapable)", async () => {
522539
// Regression guard for the style-9-prod symptom: a regular
523540
// `[data-start]` container whose GSAP timeline is shorter than its

‎packages/engine/src/services/screenshotService.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ export async function syncVideoFrameVisibility(
901901
// cannot revive a stale frame when the sub-comp host lands in the
902902
// active layer's `show` set — same mask-defense reasoning as the
903903
// `isVisualAncestorHidden` branch in `injectVideoFramesBatch`.
904-
video.style.removeProperty("display");
905904
video.style.setProperty("visibility", "hidden", "important");
906905
video.style.setProperty("pointer-events", "none", "important");
907906
if (hasImg) {

0 commit comments

Comments
 (0)