Skip to content

Allow for bubbling of events in webcomponents #12433

@batje

Description

@batje

What problem does this feature solve?

Events emitted from webcomponents never reach their parent. This limits the use of webcomponents.

The CustomEvent API has a parameter for this, called bubbles. https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles
which fires the CustomEvent not just on the emitting webcomponent, but also on all its parents.

Currently, bubbles can not be set, only details are set: https://github.com/vuejs/core/blob/9c304bfe7942a20264235865b4bb5f6e53fdee0d/packages/runtime-dom/src/apiCustomElement.ts#L

What does the proposed API look like?

The emit function could get an additional parameter, which would break things. Mainly, the emits function for webcomponents would be different than for normal components

Or bubbles could be defaulted to true, which would break other things.

Emit can now receive an object with a name & callback. A property can be added to that object for options (there are more options than just bubbling: https://developer.mozilla.org/en-US/docs/Web/API/Event )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions