Skip to content

Vue doesn't support stopImmediatePropagation() #916

@jods4

Description

@jods4

What problem does this feature solve?

In native web, you can prevent further event listeners from running by calling stopImmediatePropagation.
This doesn't work when using Vue, because Vue puts all functions into its own array and executes them regardless, from a single native event handler.

Example:

<!-- consumer of ui-form component -->
<ui-form @submit='...'>
</ui-form>

<!-- ui-form component itself -->
<form @submit='submit'><slot /></form>

<script>
function submit(e) {
  if (invalid) e.stopImmediatePropagation();
}
</script>

In this example the alternative would be to have the component emit a custom, different event; that consumer could listen to.
Or add an artificial DOM wrapper so that stppPropagation could be used instead.

What does the proposed API look like?

No new public API, but a change of behavior to match intuitive native web expectations.
Would be nice if somehow Vue could notice a call to stopImmediatePropagation and act accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions