-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Safari share links aren't copied to clipboard #15
Comments
Forgot to mention, this works in FF & Chrome. This is probably the related code: https://github.com/hackclub/game-lab/blob/0dcd140b1814897bd1d425f62ca8c4273999fcc7/dispatch.js#L7-L14 |
Yeah, most browsers only let you copy to the clipboard as a direct result of user interaction. Chrome lets you explicitly request permission via the Permissions API, but Firefox and Safari don't support it yet |
So I've done a little research here, and it turns out the issue is that Safari has some security policies in place that prevent any clipboard commenting to happen unless a DOM event is in scope (so to ensure that a DOM event triggered the copy to clipboard). I am not sure what the appropriate way of passing the DOM event to the copy function would be with the architecture of Game Lab. @leomcelroy / @cedric-h: this might be a good thing for one of you to handle. I've tried using various 3rd party clipboard libraries and none of the ones I've tried work, so I'm pretty sure it's down to the DOM event thing. It looks like this might be a very recent thing. There are some other repos with this issue popping up, notably apache/superset#18154. |
Copying doesn't work in any browser for me. Reopening |
The diff for https://github.com/hackclub/gamelab/pull/67/files doesn't make sense to me– seems like something was mis-commited or something. If I'm reading it right it seems like it removes copy logic. |
@maxwofford @leomcelroy this is my main commit - |
also @leomcelroy this commit of yours kinda reverted my commit |
Something that might help for fixing this issue: saves are deterministic. Even before we make a post request, we know the share link will be gamelab.hackclub.com/?id=MD5 where MD5 is the hash of the game state CC'ing @cedric-h who can correct me if I said something wrong. |
Can you share the URL that screenshot was taken at? It doesn't look like a part of the gamelab interface |
You can copy the URL from the console. Otherwise, it only copies some Javascript |
@grymmy can you reproduce this? |
Ignore my ask. This is an ongoing issue |
An update on this issue - while the editor still does not correctly copy to the clipboard on safari, it shows a high-quality error and feedback to the user when it files to copy to the clipboard. As a result, I believe this is quite low priority - but I've confirmed yes, still a present bug |
I believe the filenaming is deterministic (ie. even before you save, we know your share link will be EDIT: safari only lets access to the clipboard immediately in the context of an event– ie. a button click. They don’t allow it anywhere else (ie. the async context of a then after a fetch). The initial implementation of saving accounted for this by giving a deterministic share link so we could copy the link immediately instead of waiting for the fetch to finish. This may have changed since we launched. https://wolfgangrittner.dev/how-to-use-clipboard-api-in-safari/ |
No description provided.
The text was updated successfully, but these errors were encountered: