zenorocha / clipboard.js

:scissors: Modern copy to clipboard. No Flash. Just 3kb gzipped :clipboard:
https://clipboardjs.com
MIT License
33.98k stars 3.98k forks source link

Mobile devices issue #824

Closed hcgreier closed 1 year ago

hcgreier commented 1 year ago

Hi, thanks for this great JS! I used this for the first time and everything is alright so far, but: On mobile devices the script triggers the 'characters input' on my phone (i don't know how to call it...), since clipboardJS selects my text input field. I guess this is neccessary to copy the text... Is there a way to avoid this behaviour on mobile phone?

Greets, hc

obetomuniz commented 1 year ago

@hcgreier I’ll try replicate the issue in the next days, but I believe it's possible to workaround this behavior. To help me replicate, do you have some way to share the code you’re using to trigger the copy action flow? Thanks!

obetomuniz commented 1 year ago

@hcgreier after testing locally using this demo, Copy action happens without triggering the keyboard. Could you please provide the code that you're using in a demo? Thanks.

Close for now since it was not reproducible. Feel free to open with a demo.

hcgreier commented 1 year ago

Hi, I simply have a button which calls a new ClipboardJS, just like

$('#fenCopyBtn').click(function(evt) { new ClipboardJS($('#fenTxt'.val())); });

I tested this link On my phone (Huawei P30), the keyboard is triggered. As long as the script uses the "select" method, this will simply not change. Maybe there are phones which do not show this, but as long as the textfield value is selected, some will do. Maybe it is possible to put the textfield value directly in the clipboardJS without explicitly selecting it?

greets, hc