Hey team, Hope you’re well!
This issue has been frustrating me for at least a year (probably more), and hoping you can include this as a fix moving forward.
Steps to reproduce
- Add a Modal (Dynamic Rendering on or off, it makes no difference).
- Put a Video element inside it, type Embed, with a YouTube iframe whose src includes autoplay=1.
- Save and reload the builder.
Result: the video starts playing with the modal closed, every time the builder loads.
Cause
Preface this with this being Claude’s summary, not my own. Looks to be right though.
-
The preview outputs the modal’s content as a %%{children(‘id’)}%% placeholder and mounts the child elements straight into the closed .x-modal-content. The iframe is live in the DOM from load, so the browser loads it and it autoplays.
-
Dynamic Rendering doesn’t help in the builder. The cs_tag_content filter in includes/classes/Services/Rivet.php returns early when it sees the children placeholder, so nothing is wrapped in the rvt-template. The offscreen-reset handler in the app bundle then finds no template and bails out.
-
Off Canvas and Dropdown share the same mechanism.
Suggested fix (by Claude)
In the preview, always defer mounting the children of an offscreen dropzone (Modal, Off Canvas, Dropdown) until its toggleable opens (tco-toggle, state true), and unmount them after the close transition. Do this regardless of the Dynamic Rendering setting, since the builder has no need to keep closed content alive. The preview already tracks which elements are _offscreen and already opens toggles on create and select. This needs no per-provider logic and covers every iframe embed (YouTube, Vimeo, Wistia, Loom and others), <video autoplay> / <audio autoplay>, the Video element’s Player type with autoplay, Lottie and Raw Content.
Let me know if you have any questions or need any further information.