Skip to content

Shorthand for propagating events #638

Closed
@Rich-Harris

Description

@Rich-Harris

This has come up once or twice — since component events don't propagate (unlike DOM events), if you want to listen to an event coming from a deeply nested component you have to propagate the event manually, like so:

<IntermediateComponent on:foo='fire("foo",event)'/>

I don't think we should automatically bubble events, since that's a potential source of confusion and would mean adding annoying extra code to every component that had nested components. But we could make it a bit less burdensome to manually propagate events with a shorthand syntax:

<IntermediateComponent on:foo/>

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