[BUG] Copy to clipboard in the Share to social media icons is not working
Description
The following button is not working in the share to social media
- copy to clip board
I tried clicking the button few times and it does not seem to copy the contents of the link. Instead it selects the contents of the description in the profile.
I am using BRAVE BROWSER.
At the time of this issue the linkfree is at the v0.58.3
Screenshots

Additional information
No response
It's great having you contribute to this project
Welcome to the community :nerd_face:If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.
Hey Nirbhay , I want to work on this issue would you please assign me.
thanks for catching this issue. I just checked and a similar thing is happening in Chrome and it's throwing a console error.

@emmalearnscode can you help me in this all things working fine in development server.
https://user-images.githubusercontent.com/68468264/148693853-b6a684f3-a212-4d94-a5ab-6a7f9ef5470c.mp4
This is going to be hard to test as it's working in development but the copy to clipboard function is async and returns a promise so I wonder if the toast should be chained inside a .then block (see the examples here: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText )
Hmm, I also found some information that this web API only works on https and we are currently using http so that may also be causing an issue
@emmalearnscode Thanks for sharing it and helping.
@eddiejaoude we have a bug in the copy to clipboard on production being caused because the site is hosted on http instead of https and the api doesn't work on http. Is upgrading to https something you are planning to do with the project?
Maybe we should comment out the copy to clipboard icon/functionality if this is not something that can be resolved at this time? Or do you have another suggestion?
@eddiejaoude we have a bug in the copy to clipboard on production being caused because the site is hosted on http instead of https and the api doesn't work on http. Is upgrading to https something you are planning to do with the project?
Maybe we should comment out the copy to clipboard icon/functionality if this is not something that can be resolved at this time? Or do you have another suggestion?
Upgrading to https sounds like a good idea to me. If that were to happen, every link in the code (if there is any). Should be with https instead of http.
Thanks @emmalearnscode 👍 yes we plan to move to https, but i need some help with the Kubernetes config/setup - let me reach out to some people as i would like to do this on a live stream
Might be best to comment out for now
Description
When the copy to clipboard button is clicked it throws the error navigator.clipboard is undefined. I am using Firefox v95.0.2 browser. I did some research, I found that navigator.clipboard is only available when the site you're browsing has a secure origin (HTTPS). http://linkfree.eddiehub.org/ is using (HTTP). I think because of that copy to clipboard is not working.
Screenshots

Additional information
My suggestion is to use old-school copy to clipboard using the out of viewport hidden textarea trick.
const CopyLink = () => {
if (typeof(navigator.clipboard) == 'undefined') {
// Do the out of viewport hidden textarea trick.
}
navigator.clipboard.writeText(`http://linkfree.eddiehub.org/${username}`)
toast.current.show({
severity: 'success',
summary: 'Link copied to clipboard.',
})
}
My suggestion is to use old-school copy to clipboard using the out of viewport hidden textarea trick.
I think for the time being this could be a helpful solution. Since it prevents the broken site.
Further this bug can be removed as mentioned by @eddiejaoude
What are others views? @emmalearnscode
My concern with adding the workaround is that it's not acutally possible to test it in development as the copy to clipboard is working on localhost. Therefore, we won't know if it works until pushing to production. Then when we finally do upgrade to https, there will be unnecessary code which we might forget to remove. My feeling would be to comment out the sharing link and just leave the three working social sharing links visible for now until Eddie has time to upgrade. Curious to see what others think.
Therefore, we won't know if it works until pushing to production. Then when we finally do upgrade to https, there will be unnecessary code which we might forget to remove
Yeah I did not thought of this. This might turn out to be an overhead later. I agree that it should be commented.
For now, till this issue gets resolved, maybe remove the copy to clipboard icon?
This can be done using JS: https://stackoverflow.com/questions/49618618/copy-current-url-to-clipboard
https has now been added to the LinkFree project and I just tested the copy link and it works 🎉
Thank you all for the great collaboration 🔥