-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
Can't cleanly pass touch/click events to panzoom children #473
Comments
Interesting, digging into
And my guess is that My temptation is to use this same block used above to change what type of event we're listening for so the propagation is the same, but that seems a little fragile. I'd prefer that e.g. |
Thanks for opening an issue. I don't think it's possible to pass the events back down to children in any clean way. The event has already propagated from the children as events bubble up by nature. However, your first instinct of binding to the same event as panzoom is probably the right way to go. But instead of copying that block, I could expose that events variable and then you can use |
The events have been exposed on master so you don't need to copy the block. I realized that if you want to allow dragging without calling |
Wow, thanks for the quick turn-around @timmywil! I'll experiment with using the same events. |
It is clear to me after a little testing that I don't want to be calling Any element within the panzoom canvas that stops propagation (e.g. excludeClass) results in unwanted behaviors when a user pinches partially or entirely within those elements, either stopping or snapping the pan. And if they start swiping on top of those elements to pan, they won't pan at all—it's not a good user experience. |
Ah, I finally figured it out! Sorry for all the rubber ducking in the comments. Parent calls to Thanks again for the help. |
Glad you figured it out! |
🎉 This issue has been resolved in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
On latest devices, e.g. desktop Chrome or iOS Safari on iPhone X, click events to the panzoom element are still passed down to children, and we can add "isZooming" detection code using the panzoom events to determine if we want to handle the click events or not, and everything's great.
Unfortuantely, in older devices, e.g. iPhone SE iOS v12.4 on Safari, I'm seeing the click events are eaten by
event.preventDefault()
. This can be avoided using theexcludeClass
, however we have so many clickable children that it breaks the pinch/zoom behavior more often than not.I'm not quite sure what pattern to use when handling many clickable children, or if there's a different library that makes more sense for our use-case.
Your environment
4.1.x
Various
Expected behavior
Pinching to zoom doesn't click child elements and doesn't behave differently if child elements are under part of the gesture.
Clicking on child elements should trigger their click events.
Actual behavior
Pinching to zoom behaves erratically with
excludeChildren
on since there are so many clickable elements.Child elements are unfortunately only clickable with this enabled on older devices.
The text was updated successfully, but these errors were encountered: