SOLVED: Copy color to clipboard not working on non-HTTPS site

Bricks Version: 1.4
Browser: Chrome 102
OS: Windows

Hello,

I have a custom palette with some colors in it, and in list view, the button “copy” seems not to work / not copying (because when I paste, it pastes the thing I’ve copied before copying the color in the palette)

Hi Key,
Welcome to the forum and thanks so much for your report!

Unfortunately, I am not able to reproduce the issue. Would you be so kind to provide a screencast showing and explaining what’s going on?

Best regards,
timmse

Hello,

sorry for the delay, I’ve been very busy those days.
I think I know where that problem come from, it’s probably an http or https url issue.

I put the website where I had that problem online, with an https domain, and now it works !
I’m working on a new preprod website, with a http domain and the problem appears again.

I hope those informations can help, if not I can provide a screencast ( I didn’t do that now because I’m 99% sure that’s the reason it is not working).

Thanks,
Quentin

1 Like

Hi Quentin,
thanks for the feedback.

I can confirm that copying colors only works with https and have added it to our bug tracker. Let’s see what we can do. However, it is of course recommended to use https in general :wink:

Best regards
timmse

1 Like

Hey Quentin,

You are spot on. It’s not working because of the non-HTTPS connection.

Bricks uses the Clipboard API (Clipboard API - Web APIs | MDN) to copy the color palette color to the clipboard. Which only works in “secure contexts” (i.e. HTTPS).

Now we could add some “execCommand” logic to get around this. But it is no longer recommended to use this feature anymore, so we better don’t start using it now: Document.execCommand() - Web APIs | MDN

I’ll add an alert message to the builder in the next update, though. So non-HTTPS users know why copying the color doesn’t work. As right now, it looks like a bug, I agree.

4 Likes