kuma-gui icon indicating copy to clipboard operation
kuma-gui copied to clipboard

"Copy as k8s" doesn't work in Safari

Open johncowen opened this issue 1 year ago • 2 comments

What happened?

I noticed during working on https://github.com/kumahq/kuma-gui/pull/1873 that using the "Copy as k8s" copy functionality doesn't work in Safari.


Separately, I looked a little deeper into it an it looks to be due to the browser security features that don't let you perform copy actions without a user interaction.

In this instance, when the user clicks the button, we perform a HTTP request before using the response of that to write to the users clipboard, hence the write is not really a result of a user interaction, but more a successful HTTP response.

When I briefly read into it, it seems like the "user interaction" is bounded by a time period. Following that I could reliably get the copying to work by using a short setTimeout, but as soon as I took the timeout past ~999 the copying reliably stopped working, producing a browser error (which we currently swallow). Other browsers seem to be more lenient on this. Although the assumptions I've written here could be entirely wrong.

johncowen avatar Jan 08 '24 14:01 johncowen

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] avatar May 15 '24 08:05 github-actions[bot]

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] avatar Aug 14 '24 08:08 github-actions[bot]