Skip to content

Custom element wrapped in HTMLElement duplicates component when using v-model #9885

@jcbond92

Description

@jcbond92

Vue version

3.3.11

Link to minimal reproduction

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

Steps to reproduce

  • Open Stackblitz
  • Observe that my-input is double rendering when wrapped in a div while using v-model
    Screenshot 2023-12-20 at 3 31 24 PM

What is expected?

my-input should be able to use v-model when it is placed inside of an HTMLElement.

What is actually happening?

  • When my-input uses v-model the contents of the custom element's shadow root are duplicated. This only happens when it is wrapped in an HTMLElement like a div.
  • When my-input's parent is template this issue doesn't occur.
  • Additionally this only seems to impact custom elements that are created with defineCustomElement, that are then reused in Vue (components created with Lit for example, don't seem impacted).

System Info

System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.18.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.4.2 - /usr/local/bin/npm pnpm: 8.10.5 - /usr/local/bin/pnpm npmPackages: vue: ^3.3.11 => 3.3.13 

Any additional comments?

I found this issue when working to get different v-model types working with custom elements, #9883.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions