Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap does not bubble through to the document #23

Open
acarnwath opened this issue Aug 30, 2017 · 2 comments
Open

Tap does not bubble through to the document #23

acarnwath opened this issue Aug 30, 2017 · 2 comments

Comments

@acarnwath
Copy link

acarnwath commented Aug 30, 2017

I am using ractive on a page to render some dynamic content; this page has a bunch of other plugins, including custom ones, jQuery, and Zurb Foundation Sites. The trouble is, many plugins, including Foundation, have a "live listener" - like this one:

$(document).on('click.zf.trigger', '[data-open]', function() {
  triggers($(this), 'open');
});

This event is never fired on elements that have an on-tap attribute because of this line:

event.preventDefault(); // prevent compatibility mouse event

Not sure what the best solution is if there are compatibility issues (would be interested in understanding what exactly those were). For my project, I'm simply commenting it out.

@evs-chris
Copy link
Contributor

I think the goal with that line is just to prevent firing a click event after a touch event, so not so much compatibility with a particular browser - just preventing a double fire when the subsequent touch "compatibility click" event fires because the tap event also installs a click handler. Are you experiencing double fires on touch events where you're using on-tap with the preventDefault commented?

I'm not really familiar with zurb or recent jq, but does the touch.zf.trigger not subscribe the requisite touchstart, etc events? I would expect the touch events to still bubble up because propagation shouldn't be stopped.

@acarnwath
Copy link
Author

acarnwath commented Aug 30, 2017

It does not seem to fire a double event, but I haven't done extensive testing just yet. I was also mistaken in my copy/paste - it does not have the touch listener in the Foundation code (I added that in for testing) - edited the original post to avoid confusion. But even with that, the preventDefault still stifled it, and I wasn't getting double as far as I could tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants