NOTE: AI-assisted issue!
Problem
When `custom_elements.settings.default_render_variant` is configured to a preview variant (e.g. `preview:nuxt`), rendering an element as the **markup** variant produces broken output if it contains nested `CustomElement` slots: `custom_elements_prepare_slots_as_vue_3()` and `custom_elements_prepare_slots_as_web_component()` call `$element->toRenderArray()` on nested slot elements **without an argument**, which re-resolves the configured default render variant. The nested elements then render as preview containers inside the parent's markup — a broken hybrid. For the `vue-3` markup style the preview containers land inside the parent's `` tags, whose content is inert (never displayed, not reachable by the preview JS), so the nested content disappears completely.
Steps to reproduce
1. Set `default_render_variant` to a preview variant (e.g. `preview:markup`) in the custom elements settings.
2. Build a `CustomElement` with another `CustomElement` in a slot and render it as markup: `$parent->toRenderArray('markup')` (or anything hard-wiring `#theme => custom_element`), on a regular (non-API) request.
3. The nested element renders as a preview container instead of markup; with `markup_style: vue-3` it is swallowed entirely by the inert `` wrapper.
Proposed resolution
pass through the 'markup' slot style.
Issue fork custom_elements-3598522
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoComment #4
fagoComment #6
fagotested successfully + fix comes with test coverage. merged.