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
Fix lightbox bug where panning results in carousel swipe #13125
Conversation
@@ -465,6 +465,7 @@ export class AmpImageViewer extends AMP.BaseElement { | |||
// Movable. | |||
this.unlistenOnSwipePan_ = this.gestures_ | |||
.onGesture(SwipeXYRecognizer, e => { | |||
event.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like all the gesture handles preventDefault now. Maybe Gestures.get(
doesn't need to the /* opt_shouldNotPreventDefault */true
anymore? then we can remove all the event.preventDefault();
.
Only one to double check is onPointerDown
which preventsDefaults conditionally. Not sure what happens if it does it in all cases.
Approving the PR and leavings this to your discretion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why it has to be like this is because we only want to preventDefault AFTER the gesture triggers, but not when an event triggers a pending gesture. /* opt_shouldNotPreventDefault */false
results in preventing default being called on single taps, which is why it broke lightbox toggle.
This should have happened in #12930.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand wanting to get the fix in, but I would feel better about approving this if there was a TODO
issue comment added to switch from using the window.event
global to using the actual event object passed to the appropriate event listener.
So it's not possible to get an actual |
…13125) * Fix lightbox bug where panning results in carousel swipe * Add comment regarding event.preventDefault usage with gesture recognizers
…13125) * Fix lightbox bug where panning results in carousel swipe * Add comment regarding event.preventDefault usage with gesture recognizers
Fixes: double tap to zoom has a weird animation where you can’t move the image around after you have zoomed in.