Skip to content

safari doesn't allow the flyout menu. mobile + desktop #8341

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

Closed
mathematicalmichael opened this issue Jul 13, 2021 · 15 comments · Fixed by #8398
Closed

safari doesn't allow the flyout menu. mobile + desktop #8341

mathematicalmichael opened this issue Jul 13, 2021 · 15 comments · Fixed by #8398
Labels
Bug A bug

Comments

@mathematicalmichael
Copy link

mathematicalmichael commented Jul 13, 2021

I am noticing that safari consistently doesn't allow the flyout menu. mobile + desktop both exhibit the behavior. Desktop Safari: Version 14.1.1 (16611.2.7.1.4)
Mobile Safari: iOS 14.6

I don't see an existing issue tracking this. Basically it's just unresponsive entirely.

This person faced a similar issue it seems: https://stackoverflow.com/questions/66436744/how-to-activate-the-rtd-flyout-menu. Playing with "prevent cross-site tracking" does nothing.

Originally posted by @mathematicalmichael in #8333 (comment)

Console from Safari (when I click on the flyout menu):
image

Opening it in Opera shows that it works, so I think it's the browser. nothing in that console.

site: mud.rtfd.io

@stsewd stsewd added the Bug A bug label Jul 13, 2021
@stsewd
Copy link
Member

stsewd commented Jul 13, 2021

This looks comming from

function gtag(){dataLayer.push(arguments);}
. Maybe something to do with safari's built-in antitracker?

@stsewd
Copy link
Member

stsewd commented Jul 13, 2021

From https://developers.google.com/gtagjs/devguide/datalayer we are using it like in the example. Maybe safari needs to be explicit about globals? Can you try this on your safari console (sorry, I don't use mac).

window.dataLayer = window.dataLayer || [];
dataLayer

@mathematicalmichael
Copy link
Author

@stsewd wow that was magic.
I entered that into the console and wam-bam the flyout menu worked!

@Daltz333
Copy link

Bump. Had a user bring this up.

@Daltz333
Copy link

Another bump. This is critical functionality. This means language pop-out menu does not work on iPhone devices, which is a large portion of our viewer base.

@stsewd
Copy link
Member

stsewd commented Jul 29, 2021

If this code works on the console #8341 (comment), then I'm not sure what the problem could be, can't debug more since I don't use safari.

@ericholscher
Copy link
Member

I have Safari and can confirm this issue and the fix. Do we just need to put window.dataLayer = window.dataLayer || []; in our JS?

@stsewd
Copy link
Member

stsewd commented Aug 5, 2021

Just to be clear, we do have that line in our current js

window.dataLayer = window.dataLayer || [];
, we might have a syntax error (missing ; in the above statement). We will confirm this in a couple of hours.

@ericholscher
Copy link
Member

ericholscher commented Aug 5, 2021

I'm trying to reproduce this, and I can't figure out what's happening. It only appears to happen on the mud docs. I tried it on:

So I'm not really sure how to diagnose this without a bit more information. It seems to only be effecting a small number of docs sets -- is there anything you can do on your docs to stop this from happening? Or cause it to happen on other docs -- I can't really figure out the issue without being able to reproduce it.

@Daltz333
Copy link

Daltz333 commented Aug 5, 2021

Another case is https://docs.wpilib.org/en/stable

@ericholscher
Copy link
Member

It looks like you've disabled google analytics on your projects? Guessing that's the issue.

@ericholscher
Copy link
Member

ericholscher commented Aug 5, 2021

The block of code that's executing isn't being run, but somehow that function is being defined:

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}

So somehow line 20 is not being executed, but line 21 is, it seems.

The caller is:

if (typeof gtag !== 'undefined') {
// https://developers.google.com/analytics/devguides/collection/gtagjs/events
gtag('event', 'Click', {
'event_category': 'Flyout',
'event_label': flyout_state,
'send_to': 'rtfd'
});

Which is checking for the value to be defined, which it apparently is.

@davidfischer
Copy link
Contributor

Strangely only seems to affect Safari though due to a subtle difference in scope of a defined function. Regardless, should be a simple fix.

@ericholscher
Copy link
Member

I did a PR to fix this by disabling the caller when analytics are disabled. I think there's probably a better solution if someone knows JS well, but the naive approach should solve this issue at least.

@mathematicalmichael
Copy link
Author

I really appreciate the fix, because yes, I did disable google analytics.

Very odd that it's so Safari specific.

Thank you all so much!

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

Successfully merging a pull request may close this issue.

5 participants