Skip to content

[custom-element] Crash in _renderSlots when Teleport target is ancestor of custom element host (shadowRoot: false) #13955

@canciodev

Description

@canciodev

Vue version

3.5.22

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-ycis7iro?file=src%2FApp.vue

Steps to reproduce

Steps to reproduce

  1. Use defineCustomElement to create a custom element with shadowRoot: false.

  2. Inside its template, include a ….

  3. Mount the custom element so that the body contains the custom element host.

  4. Open the page and observe console.

What is expected?

Teleport should work reliably even if its to target is an ancestor of the custom element host. The custom element should correctly render its slotted content without errors.

What is actually happening?

vue.js:11802 Uncaught TypeError: Cannot read properties of null (reading 'insertBefore')
at VueCustomElement._renderSlots (vue.js:11802:18)
at callWithErrorHandling (vue.js:2296:19)
at callWithAsyncErrorHandling (vue.js:2303:17)
at invokeVNodeHook (vue.js:9916:3)
at vue.js:7537:19
at flushPostFlushCbs (vue.js:2481:28)
at render2 (vue.js:8196:7)
at mount (vue.js:6117:13)
at app.mount (vue.js:12387:19)
at VueCustomElement._mount (vue.js:11610:15)

System Info

Any additional comments?

#13900

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: custom elements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions