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

When tapping to close, overlapped div gets tapped also (tap event propagation) #2027

Open
coudrak opened this issue Mar 22, 2023 · 1 comment

Comments

@coudrak
Copy link

coudrak commented Mar 22, 2023

On mobile, with the version 5, and with this specific options:

showHideAnimationType: 'none',
imageClickAction: 'close',
tapAction: 'close',
doubleTapAction: false,

tapping anywhere other than the topbar X button closes photoswipe immediately (that's what I want), but the click event is propagated to the onclick event of the div under.

If I remove "doubleTapAction: false", it works but Photoswipe needs 1 second to close.

@coudrak
Copy link
Author

coudrak commented Jun 27, 2023

My fix for this problem:

lightbox.on('afterInit', () => {
	document.querySelector('.pswp__container').addEventListener('touchstart', function(e) {
		e.preventDefault();
		e.stopPropagation();
	});
});

@coudrak coudrak closed this as completed Jun 27, 2023
@coudrak coudrak reopened this Jun 27, 2023
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

1 participant