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

bug: conflicts between navigation() and Safari's navigation() #289

Open
dragoncoder047 opened this issue Jul 28, 2024 · 18 comments · May be fixed by #430
Open

bug: conflicts between navigation() and Safari's navigation() #289

dragoncoder047 opened this issue Jul 28, 2024 · 18 comments · May be fixed by #430
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dragoncoder047
Copy link
Contributor

Describe the bug

This bug does not occur in Chrome or Firefox, it only occurs in Safari. The game just fails to load.

Version

3001.0.0-alpha.19 loaded from unpkg.

To Reproduce

Call kaplay(). That's it!!

Expected behavior

The game works!

Screenshots

Screenshot 2024-07-28 at 1 58 19 PM
@dragoncoder047 dragoncoder047 added the bug Something isn't working label Jul 28, 2024
@lajbel
Copy link
Collaborator

lajbel commented Jul 28, 2024

will investigate, I don't have Safari lol, that's the only problem

@lajbel
Copy link
Collaborator

lajbel commented Jul 28, 2024

can you disable globals and test if it works?

@lajbel
Copy link
Collaborator

lajbel commented Jul 28, 2024

Is global: false in kaplay({})

@niceEli
Copy link
Member

niceEli commented Jul 28, 2024

Testing KAPLAY alpha 18.1 on iOS/iPadOS Safari I don't have this issue

@niceEli
Copy link
Member

niceEli commented Jul 28, 2024

After further testing on alpha 19.1 there also seems to be no issues. What version of kaplay are you using?

@dragoncoder047
Copy link
Contributor Author

Im using whatever loads from https://unpkg.com/[email protected]/dist/kaplay.js -- 3001alpha19.1, I guess. And I am on Mac Safari, not iPad.

@dragoncoder047
Copy link
Contributor Author

dragoncoder047 commented Jul 28, 2024

Is global: false in kaplay({})

never mind, this fixes the "read only property" error.

But shouldn't this be documented somewhere ("known bug: you can't use global: true in Safari")?

@lajbel
Copy link
Collaborator

lajbel commented Jul 29, 2024

It was to confirm what is related to the error, will investigate more

@lajbel
Copy link
Collaborator

lajbel commented Aug 2, 2024

It still happens?

@dragoncoder047
Copy link
Contributor Author

It still happens?

hang on, will test

@dragoncoder047
Copy link
Contributor Author

It still happens?

hang on, will test

yes

and this is with bleeding edge from #301

@lajbel lajbel self-assigned this Aug 2, 2024
@lajbel lajbel added this to the 3001 milestone Aug 2, 2024
@lajbel
Copy link
Collaborator

lajbel commented Aug 15, 2024

I don't have a safari device (only iPhone, and there works) so it's kinda hard to test but the bug seems to be here:

kaplay.ts 1326

    if (gopt.global !== false) {
        for (const key in k) {
            (<any> window[<any> key]) = k[key as keyof KAPLAYCtx];
        }
    }

@lajbel
Copy link
Collaborator

lajbel commented Aug 15, 2024

Maybe window is readonly in Safari? or we are assigning a readonly prop that's present only on Safari?

@dragoncoder047
Copy link
Contributor Author

I figured out what is the problem: navigation() conflicts with the Navigation API that can be enabled in Safari with a feature flag (I have it turned on and it must be readonly).

I found it by adding:

    if (gopt.global !== false) {
        for (const key in k) {
+           console.log("adding key:", key);
            (<any> window[<any> key]) = k[key as keyof KAPLAYCtx];
        }
    }

and I got

Screenshot 2024-09-07 at 3 01 02 PM

Stinks that the WebKit people couldn't get the error message to say which property was readonly, that would have made it so much more obvious from the beginning...

@lajbel
Copy link
Collaborator

lajbel commented Sep 7, 2024

we probably should change it

@lajbel lajbel changed the title bug: Safari gives "assignment to readonly property" error when kaplay() is called bug: conflicts between navigation() and Safari's navigation() Sep 7, 2024
@dragoncoder047
Copy link
Contributor Author

My suggestion would be "navigator" because that's what the component makes the object into, and the docs for it use that language too

@dragoncoder047
Copy link
Contributor Author

gosh, whoops, never mind, that one conflicts with an even importanter property!!

@mflerackers
Copy link
Member

Yes, navigator was my first choice, but I couldn't use it due to that reason. That's why I took navigation.
We had the same problem with anchor, which was called origin originally.

@lajbel lajbel linked a pull request Oct 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: TODO
Development

Successfully merging a pull request may close this issue.

4 participants