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

Disable parent scrolling and swiping in lightbox #334

Merged
merged 3 commits into from
Sep 29, 2015

Conversation

dvoytenko
Copy link
Contributor

Closes #332.
Closes #74.

// TODO(dvoytenko): configure how to close. Or maybe leave it completely
// up to "on" element.
this.element.addEventListener('click', () => this.close());
gestures.onGesture(TapRecognizer, () => this.close());
gestures.onGesture(SwipeXYRecognizer, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my knowledge purposes. how does adding an empty subscriber block the scroll and side-swipe events?

thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gestures are exclusive. I.e. you can have a "tap" and a "swipe" at the same time. It's very different from events which fire all at the same time and can overlap. Once you say "I recognize swipeX", no other conflicting gesture will be allowed which is what we want here. In a way you can consider scroll and side-swipe as other gestures. Practically, once gesture is recognized it consumes all of the pointer events by stopping propagation and preventing default.

@erwinmombay
Copy link
Member

other than my question. LGTM

dvoytenko added a commit that referenced this pull request Sep 29, 2015
Disable parent scrolling and swiping in lightbox
@dvoytenko dvoytenko merged commit 1f9c57e into ampproject:master Sep 29, 2015
@dvoytenko dvoytenko deleted the bb1 branch September 29, 2015 05:46
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

Successfully merging this pull request may close these issues.

2 participants