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

outbound-links script causes media lightboxes to open in new tab #1941

Closed
2 tasks done
ianmcilwraith opened this issue Jun 1, 2022 · 6 comments · Fixed by #2208
Closed
2 tasks done

outbound-links script causes media lightboxes to open in new tab #1941

ianmcilwraith opened this issue Jun 1, 2022 · 6 comments · Fixed by #2208

Comments

@ianmcilwraith
Copy link

ianmcilwraith commented Jun 1, 2022

Past Issues Searched

  • I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Plausible Cloud from plausible.io

Describe the bug

I have two sites (WordPress) where lightboxes are in use, and of course on both sites Plausible is enabled with the Outbound Links script. On one site, the lightbox is used for images, and on the second site for videos. In both cases, the behavior witnessed is that the lightbox appears for a quick second before opening the image/video in a new tab. I narrowed down the issue to the Plausible outbound-links.js script causing this issue.

This is the relevant section of the outbound-links.js script that was highlighted by the browser debugger as the last step before the redirection happened.
(setTimeout(function(){a.href=e.href},150),t.preventDefault()))

This behavior does not happen with just the plausible.js script.
This is the second site mentioned — clicking on the "Play Trailer" button will open a popup window for a second before redirecting to the linked video. The outbound links script is enabled on this site.

Happy to provide further debugging info as needed.

Expected behavior

The expected behavior is simply that the media opens in a lightbox and doesn't redirect to the media URL.

Screenshots

No response

Environment

- OS: macOS Monterey
- Browser: Firefox
- Browser Version: 100.0.2

Same behavior happens in Safari on iOS, Safari on macOS, Chrome on macOS, likely all browsers.
@ianmcilwraith
Copy link
Author

@RobertJoonas Thank you for the fix for this issue in #1938. Any idea on when it will be pushed to master?

@RobertJoonas
Copy link
Contributor

Hey @ianmcilwraith!

I'm currently working on some other things related to it so we will probably ship it all together. Don't want to make any strict promises but hopefully it won't be long. Fingers crossed!

@RobertJoonas
Copy link
Contributor

@ianmcilwraith, I'm now finalizing this bug fix in #2109. I wanted to ask if the issue was really in opening the lightbox link in a new tab? I tested on Ubuntu/Firefox + macOS Monterey/Firefox and from what I witnessed, the link opened in the same tab. I cannot think of any way that the current outbound-links script would cause the link to open in a new tab, as Plausible will not intercept when the link is set to open in a new tab. Can you please confirm?

@ianmcilwraith
Copy link
Author

@RobertJoonas I just tested again and it the Lightbox link was opening in the same tab, not a new tab. Apologies if I misspoke in the initial comment!

@RobertJoonas
Copy link
Contributor

RobertJoonas commented Sep 16, 2022

Hey @ianmcilwraith!

Quick update: we've now deployed the fixed outbound-links code to our staging domain. I wanted to ask if you'd be up for testing the new solution? It should now not intercept your lightbox behavior.

To test it, you can simply change the src attribute in your Plausible snippet to:

https://staging.plausible.io/js/script.outbound-links.js

Thanks for your help and feedback with this! :)

@ianmcilwraith
Copy link
Author

So sorry for being late here @RobertJoonas, but I just confirmed on the live version that this is fixed and light boxes/outbound link tracking works as intended.

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 a pull request may close this issue.

2 participants