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

Shadow DOM problems #2096

Open
AlyonaCh opened this issue Apr 8, 2024 · 0 comments · May be fixed by #2097
Open

Shadow DOM problems #2096

AlyonaCh opened this issue Apr 8, 2024 · 0 comments · May be fixed by #2097

Comments

@AlyonaCh
Copy link

AlyonaCh commented Apr 8, 2024

When using PhotoSwipe inside a shadow root, zoom functionality fails when clicking on an image, and closing the gallery fails when clicking on the background. This issue arises because the event is attached to the window using "events.add(window)". Consequently, the event's target becomes the host element of the shadow root, rather than the element clicked by the user. This leads to the problem because PhotoSwipe relies on the presence of classes like 'pswp__img', 'pswp__item', 'pswp__zoom-wrap' when processing a click, which the host element lacks. The solution lies in attaching the event not to the window, but to an element within the shadow root. Is it possible to specify the element to which events are attached in the options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants