react-copy-to-clipboard icon indicating copy to clipboard operation
react-copy-to-clipboard copied to clipboard

Two clicks required to copy sometimes

Open mhuggins opened this issue 7 years ago • 14 comments

This is an issue in copy-to-clipboard itself, which would be fixed if this PR is merged: https://github.com/sudodoki/copy-to-clipboard/pull/63. Since copy-to-clipboard seems to be abandoned, is there a scenario where this repo might use a supported fork or anything along those lines?

mhuggins avatar Oct 25 '18 17:10 mhuggins

Last response was

Would it be possible to add a maintainer to this repo to help get in some vital fixes like this one?

Sure, anyone who is willing could become one, should I add you?

So I reckon someone could totally do that

nkbt avatar Oct 25 '18 21:10 nkbt

please...may be...Why do I have to click twice to copy the address of the current click?

suhongyan avatar Dec 29 '18 06:12 suhongyan

@nkbt any news about a possible fix ? Spasibo!

ekokotov avatar Apr 11 '19 16:04 ekokotov

No updates from the original lib yet ¯_(ツ)_/¯... Not much we can do here

nkbt avatar Apr 11 '19 16:04 nkbt

Yeah, the original lib owner (@sudodoki) would like a way to reproduce it, and I don't have a suggestion on how to do that. It happened for me in one case, but not another, and I didn't have time to invest to see why -- forking and fixing the lib was my route.

mhuggins avatar Apr 11 '19 17:04 mhuggins

Well, @mhuggins... So if you did not have time to invest to see why some elusive problem exists, what makes you think lib maintainers have time to invest to do it?

nkbt avatar Apr 11 '19 22:04 nkbt

I don't, but there's an open PR that fixes the issue that he won't pull in either. Many other users of the lib have commented on the PR stating that it fixes the issue.

mhuggins avatar Apr 11 '19 22:04 mhuggins

@mhuggins it's not that I won't pull it, it just that removeAllRanges is already called as I mentioned in here so I don't get what is the case when you need to call it twice and asked for help digging to the bottom of this. There were some minor changes in recent version of upstream lib, and I wonder whether that might affect this issue in any way

sudodoki avatar Apr 12 '19 06:04 sudodoki

any news about a possible fix ?

well-monkey avatar Apr 29 '19 09:04 well-monkey

@sudodoki I see your point. I didn't get to dig into it at the time, but I do know that the change solved the problem for me. It was a very specific scenario where I encountered it, but other scenarios worked, so I'm not sure what the difference was.

mhuggins avatar Apr 29 '19 14:04 mhuggins

"Solved" by adding: document.getElementById('ID_OF_BUTTON').click(); to onCopy handler. ...

ghost avatar Aug 22 '19 20:08 ghost

I also ran into this problem. This component uses function from pocket copy-to-clipboard, which takes the text as the first argument and copy it into the buffer.

helloalicesmith avatar Nov 22 '19 15:11 helloalicesmith

Same. Any alternative packages to recommend?

developdeez avatar Feb 08 '20 01:02 developdeez

export default (words) => { const textField = document.createElement("textarea"); textField.innerText = words; document.body.appendChild(textField); textField.select(); document.execCommand("copy"); }; Need to hide the textarea but it should work

developdeez avatar Feb 08 '20 01:02 developdeez