Copy button (clipboard-btn) not working in my instance #8087

Closed
opened 2025-11-02 07:53:30 -06:00 by GiteaMirror · 15 comments
Owner

Originally created by @duchenpaul on GitHub (Nov 9, 2021).

Gitea Version

Gitea Version: 1.15.6

Git Version

No response

Operating System

Docker, host system: Debian

How are you running Gitea?

Run Gitea from docker, on amd64 system.

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

I tried to copy the url by clicking the clipboard icon, but it shows Use ⌘C or Ctrl-C to copy, instead of Link has been copied, there is something wrong somewhere, but not sure.

From the chrome consule there is no error pops up.
From the backend, neither.

Screenshots

image

Originally created by @duchenpaul on GitHub (Nov 9, 2021). ### Gitea Version Gitea Version: 1.15.6 ### Git Version _No response_ ### Operating System Docker, host system: Debian ### How are you running Gitea? Run Gitea from docker, on amd64 system. ### Database MySQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description I tried to copy the url by clicking the clipboard icon, but it shows `Use ⌘C or Ctrl-C to copy`, instead of `Link has been copied`, there is something wrong somewhere, but not sure. From the chrome consule there is no error pops up. From the backend, neither. ### Screenshots ![image](https://user-images.githubusercontent.com/8120099/140863437-3faec24b-b837-4039-a9b8-256b0a211327.png)
Author
Owner

@wxiaoguang commented on GitHub (Nov 9, 2021):

If you see Use ⌘C or Ctrl-C to copy, it is usually caused by your browser, your browser denied the copy action.

@wxiaoguang commented on GitHub (Nov 9, 2021): If you see `Use ⌘C or Ctrl-C to copy`, it is usually caused by your browser, your browser denied the copy action.
Author
Owner

@duchenpaul commented on GitHub (Nov 9, 2021):

ok, how to enable it? I tries this on two devices, no lucks
and it works for Gitea demo site

@duchenpaul commented on GitHub (Nov 9, 2021): ok, how to enable it? I tries this on two devices, no lucks and it works for Gitea demo site
Author
Owner

@wxiaoguang commented on GitHub (Nov 9, 2021):

TBH, I have no idea, the code for 1.16.0+dev-474-g021df2962 is exactly the same as try.gitea.io

The copy code is pretty simple: https://github.com/go-gitea/gitea/blob/main/web_src/js/features/clipboard.js

Can you try the code in your browser?

@wxiaoguang commented on GitHub (Nov 9, 2021): TBH, I have no idea, the code for 1.16.0+dev-474-g021df2962 is exactly the same as try.gitea.io The copy code is pretty simple: https://github.com/go-gitea/gitea/blob/main/web_src/js/features/clipboard.js Can you try the code in your browser?
Author
Owner

@duchenpaul commented on GitHub (Nov 9, 2021):

I enabled debug level logging in chrome, saw this error when I click copy button

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
add @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
(anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
sn @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
on @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
events @ index.js?v=66b87c123c0ab767e55d95c43d170494:1
initialize @ index.js?v=66b87c123c0ab767e55d95c43d170494:1
(anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:1
each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62
l.fn.popup @ index.js?v=66b87c123c0ab767e55d95c43d170494:1
jh @ index.js?v=66b87c123c0ab767e55d95c43d170494:25
(anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25
(anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25
Dc @ index.js?v=66b87c123c0ab767e55d95c43d170494:25
(anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25
@duchenpaul commented on GitHub (Nov 9, 2021): I enabled debug level logging in chrome, saw this error when I click copy button ``` [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 add @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 (anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 sn @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 on @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 events @ index.js?v=66b87c123c0ab767e55d95c43d170494:1 initialize @ index.js?v=66b87c123c0ab767e55d95c43d170494:1 (anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:1 each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 each @ index.js?v=66b87c123c0ab767e55d95c43d170494:62 l.fn.popup @ index.js?v=66b87c123c0ab767e55d95c43d170494:1 jh @ index.js?v=66b87c123c0ab767e55d95c43d170494:25 (anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25 (anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25 Dc @ index.js?v=66b87c123c0ab767e55d95c43d170494:25 (anonymous) @ index.js?v=66b87c123c0ab767e55d95c43d170494:25 ```
Author
Owner

@duchenpaul commented on GitHub (Nov 9, 2021):

Will this help? if you can read chinese
https://www.coder.work/article/943540

@duchenpaul commented on GitHub (Nov 9, 2021): Will this help? if you can read chinese https://www.coder.work/article/943540
Author
Owner

@wxiaoguang commented on GitHub (Nov 9, 2021):

Not related. If you can not find some methods to reproduce this problem, it would be difficult to continue to debug, since it works on try.gitea.io, the same code.

@wxiaoguang commented on GitHub (Nov 9, 2021): Not related. If you can not find some methods to reproduce this problem, it would be difficult to continue to debug, since it works on try.gitea.io, the same code.
Author
Owner

@silverwind commented on GitHub (Nov 10, 2021):

Might be an issue with the clipboard fallback code that was recently added. I see the instance is running on http, so the code will definitely branch to the fallback because navigator.clipboard.writeText is not enabled on non-https origins:

43bbc54783/web_src/js/features/clipboard.js (L25-L46)

cc: @tech-meppem

@silverwind commented on GitHub (Nov 10, 2021): Might be an issue with the clipboard fallback code that was recently added. I see the instance is running on `http`, so the code will definitely branch to the fallback because `navigator.clipboard.writeText` is not enabled on non-https origins: https://github.com/go-gitea/gitea/blob/43bbc5478370cbfe3ab1eed730ea002ccec74708/web_src/js/features/clipboard.js#L25-L46 cc: @tech-meppem
Author
Owner

@silverwind commented on GitHub (Nov 10, 2021):

Can't reproduce. Fallback works fine for me on all major browsers. What version of Chrome is this observed on and does it work in other browsers?

@silverwind commented on GitHub (Nov 10, 2021): Can't reproduce. Fallback works fine for me on all major browsers. What version of Chrome is this observed on and does it work in other browsers?
Author
Owner

@tech-meppem commented on GitHub (Nov 10, 2021):

This is what I attempted for my fix, because this is what happens on non-https sites.
Are you using your site via Https?
If not, then the copy to clipboard won't work for anything.

or at least, unless you have the fix stated above merged in, which I don't know which version it's actually going to be included in.

@tech-meppem commented on GitHub (Nov 10, 2021): This is what I attempted for my fix, because this is what happens on non-https sites. Are you using your site via Https? If not, then the copy to clipboard won't work for anything. or at least, unless you have the fix stated above merged in, which I don't know which version it's actually going to be included in.
Author
Owner

@silverwind commented on GitHub (Nov 10, 2021):

OPs version above indicates they have a version with the fix included. Might be worth a try to clear browser cache and try again.

@silverwind commented on GitHub (Nov 10, 2021): OPs version above indicates they have a version with the fix included. Might be worth a try to clear browser cache and try again.
Author
Owner

@duchenpaul commented on GitHub (Nov 11, 2021):

Yes, that was my thought as well, I am using http instead of https

@duchenpaul commented on GitHub (Nov 11, 2021): Yes, that was my thought as well, I am using http instead of https
Author
Owner

@duchenpaul commented on GitHub (Nov 11, 2021):

Using incognico mode not helping as well, and I cannot find anywhere to see the error, including chrome console

@duchenpaul commented on GitHub (Nov 11, 2021): Using incognico mode not helping as well, and I cannot find anywhere to see the error, including chrome console
Author
Owner

@duchenpaul commented on GitHub (Nov 11, 2021):

Correction:
My gitea version is Gitea Version: 1.15.6

@duchenpaul commented on GitHub (Nov 11, 2021): Correction: My gitea version is `Gitea Version: 1.15.6`
Author
Owner

@wxiaoguang commented on GitHub (Nov 11, 2021):

Please make sure you are using the correct version. The clipboard for non-https was fixed in 1.16

@wxiaoguang commented on GitHub (Nov 11, 2021): Please make sure you are using the correct version. The clipboard for non-https was fixed in 1.16
Author
Owner

@duchenpaul commented on GitHub (Nov 11, 2021):

Thanks, it works for me when I changed the docker images tag to dev, where the version is 1.16.0+dev-488-g0e189eeca

@duchenpaul commented on GitHub (Nov 11, 2021): Thanks, it works for me when I changed the docker images tag to dev, where the version is `1.16.0+dev-488-g0e189eeca`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8087