fix(engine): preserve nested sibling video layout (#3639)

This commit is contained in:
Miguel Ángel
2026-09-13 04:20:34 +00:00
committed by GitHub
parent 1acc65dbf8
commit fdf9ffac95
2 changed files with 17 additions and 1 deletions
@@ -518,6 +518,23 @@ describe("video-frame injection respects ancestor visibility", () => {
expect(seededImg.style.visibility).toBe("hidden");
});
it("preserves display:none on an inactive in-flow video so its sibling keeps the same box", async () => {
const { teardown, setup } = withGlobals(setupHostHiddenScenario({}));
setup.video.style.display = "none";
const seededImg = setup.document.createElement("img");
seededImg.classList.add("__render_frame__");
setup.video.parentNode?.insertBefore(seededImg, setup.video.nextSibling);
try {
await syncVideoFrameVisibility(passthroughPage(), []);
} finally {
teardown();
}
expect(setup.video.style.display).toBe("none");
expect(seededImg.style.visibility).toBe("hidden");
});
it("still injects when a plain [data-start] host is visibility:hidden (CSS-escapable)", async () => {
// Regression guard for the style-9-prod symptom: a regular
// `[data-start]` container whose GSAP timeline is shorter than its
@@ -901,7 +901,6 @@ export async function syncVideoFrameVisibility(
// cannot revive a stale frame when the sub-comp host lands in the
// active layer's `show` set — same mask-defense reasoning as the
// `isVisualAncestorHidden` branch in `injectVideoFramesBatch`.
video.style.removeProperty("display");
video.style.setProperty("visibility", "hidden", "important");
video.style.setProperty("pointer-events", "none", "important");
if (hasImg) {