dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent

Home Page:http://photoswipe.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When Clicking Close Button, Overlapped Div Gets Clicked Also!

fatihkizmaz opened this issue · comments

This issue occurs on mobile only.
When i clicked / tapped close button, overlapped div gets clicked also!
I tested it with Google Chrome. When i use normally no problem, when i switch to mobile mode issue occurs.

I made a pen for problem: https://codepen.io/anon/pen/PVXQvY
You can try it with normal and mobile modes.
Whwn using mobile DivModal gets clicked when i close PhotoSwipe!

@fatihkizmaz, I fixed the issue in this way:

document.querySelector('.pswp').addEventListener('pswpTap', function (e)
{
    e.preventDefault();
    e.stopPropagation();
}, true);

@vskripkin Your solution worked. Thank you very much.
But it seems like a bit hacky. I will use it until a permanent solution.

@fatihkizmaz, I fixed the issue in this way:

document.querySelector('.pswp').addEventListener('pswpTap', function (e)
{
    e.preventDefault();
    e.stopPropagation();
}, true);

This solution works but after applying this solution another problem come up.
Hiding UI on tapping does not work after adding this.
So this solution causes another problems while solving one.

commented

I can confirm this. Preventing bubbling solves it for now but there should be a better solution.

I found it will fix when this change applied.
This change causes set the bubbling to false when initializing custom event.

e.initCustomEvent( 'pswpTap', true, true, eDetail );

to

e.initCustomEvent( 'pswpTap', false, true, eDetail );

But, I don't know how this change will affect whole program.

@dimsemenov can this be released officially, please? It seems to have been fixed 2 months ago, but not released. WooCommerce is running v4.1.3 (from Jan 9, 2019), and that's still the latest release.

+1 can this be merged into the latest WooCommerce release?

Any chance this will be fixed soon? This issue is coming up on its first birthday 😞

fixed by v5.0.