Skip to content

Using return false and/or stopPropagation on click events doesn't play nice with other libraries #327

@philipwalton

Description

@philipwalton

Any library that binds click events to the document could potentially have functionality broken because jquery-ujs stops event propagation from [data-remote] clicks.

For example, most tooltip libraries are supposed to hide a shown tooltip when you click anywhere outside of the tooltip target element, but if your click outside happens to be on a link with a data-remote attribute, that event gets killed and the tooltip doesn't go away. Obviously this is a minor example, but it should help illustrate the conflict.

Since jquery-ujs is very high-level and abstract, I personally don't see any compelling reasons (other than perhaps historical) for it to be stopping event propagation.

Admittedly, making this change would likely break functionality on existing sites, so perhaps it could be set with a config option, so projects that rely on this behavior can still have it.

If this is a direction the jquery-ujs project is willing to go, I'd be happy to submit a pull request with the changes.

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