Skip to content

Error in _injectChildStyle when shadowRoot is disabled in CustomElementApi #12630

Open
@canciodev

Description

@canciodev

Vue version

3.5.13

Link to minimal reproduction

stackblitz.com/edit/vitejs-vite-hebvmeai?file=src%2Fcomponents%2FHelloWorld.ce.vue

Steps to reproduce

1- Create a Vue component with child component inside with scoped styles. using the Custom Element API.
2- Disable Shadow DOM.
3- Open the browser console and observe the shadowRoot error when _injectChildStyle runs.

What is expected?

When the shadowRoot option is disabled (or otherwise omitted) and child components have their own styles, Vue should inject (or refrain from injecting) those styles without throwing console errors.

What is actually happening?

Currently, when shadowRoot is disabled, the _injectChildStyle function attempts to apply child styles to a Shadow DOM. Since shadowRoot does not exist, a console error occurs indicating it cannot access shadowRoot or its methods.

System Info

No response

Any additional comments?

No response

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