-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onClick() callback prevents text from being copied #98
Comments
Additionally, I think it would be better if the function returned a promise |
wonder whether that's because of preventDefault in onCopy branching logic https://github.com/sudodoki/copy-to-clipboard/blob/master/index.js#L67 |
we had callback support at some point, but that wasn't too useful given we are doing sync stuff all the time (prompt is blocking as well). Given a newer api that is promise based, we had some initial discussion on the level 'well, it would be cool to support it and the probably wrapping everying into promise interface', but no work was done as nobody had time for it |
Cheers for looking into it. For now I'll just make the assumption that the copying was successful but it's not ideal going forwards And re: the promise, it's not a deal breaker, just a nice to have 😄 |
Same problem with me! When I remove the |
Same problem here, tested with Firefox Browser Developer Edition 79.0b9(x64) ! BTW, why do we need the e.preventDefault() line please ? Can this line be safely removed ? @sudodoki |
if you have So basically, providing |
MacOS Mojave 10.14.6
Tested on both Chrome 81 and Safari 13
copy-to-clipboard 3.3.1
This seems like a pretty fundamentally critical bug.
When I use the function on a button's
onClick
event, it works fine. However when I specify anonCopy()
too, it just doesn't copy anything. It doesn't matter what's inside the callback function, or whether it's an arrow function, or whether the function is defined outside of the handler, or anything else really.Works:
Doesn't work:
The text was updated successfully, but these errors were encountered: