Skip to content

Breaks checkbox click (and other situations?) #2

@natevw

Description

@natevw

The touch.enabled timeout isn't a very good solution to avoiding extra clicks. By returning false from the "second" click, you cause jQuery to preventDefault() its event handling. But the "second" click is sometimes just the same click being bubbled up to a parent view.

E.g. if I add a log right above where this logic is happening I see this for a single click on a checkbox:

Handling click in <Ember.Checkbox:ember713> touch.enabled: true        ember-fastclick.js:98
Handling click in <Ember.View:ember696> touch.enabled: false        ember-fastclick.js:98

So the second call sees touch disabled, and returns false. This prevents default on the click which prevents the checkbox from being triggered! There are probably other situations where this can cause trouble, but this is the most apparent in an app I am helping with.

Shouldn't the evt.preventDefault() in your "touchend" handler already prevent the browser from sending its own click duplicating the simulated one? Or why exactly was a2fc30e added?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions