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

Fix lightbox bug where panning results in carousel swipe #13125

Merged
merged 2 commits into from Jan 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/amp-image-viewer/0.1/amp-image-viewer.js
Expand Up @@ -465,6 +465,7 @@ export class AmpImageViewer extends AMP.BaseElement {
// Movable.
this.unlistenOnSwipePan_ = this.gestures_
.onGesture(SwipeXYRecognizer, e => {
event.preventDefault();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

this.onMove_(e.data.deltaX, e.data.deltaY, false);
if (e.data.last) {
this.onMoveRelease_(e.data.velocityX, e.data.velocityY);
Expand Down