Comments (2)
It seems the issue is caused by creating an element in body to copy the text using the old copy method. The navigator clipboard API should be used first if available. And the element should be created inside the focus item instead of body could potentially resolve the issue.
from use-clippy.
This is a great find. I'm not positive that I'll have bandwidth to address it though, but a PR would be welcome.
I'd have one concern with putting the new input inside the currently focused element, being that that may not work if the currently focused element is a text input. The best bet may be to remember the previously-focused element, then focus it again after the copy action is complete.
from use-clippy.
Related Issues (20)
- [Security] Reading the clipboard is disabled in browsers.
- Deploy a live demo to GH Pages.
- Write a Medium article for how this was made and/or how to use it.
- Unwanted side effects in Safari HOT 4
- Have problem on Firefox HOT 3
- Memoize setClipboard
- We don't execute document.execCommand() this time, because it is called recursively. HOT 2
- Copy events do not trigger local state changes in latest version of Chrome. HOT 4
- Get clipboard contents on load? HOT 5
- Safari support HOT 3
- Reading the clipboard does not work in some versions of Safari. HOT 2
- paste not updating `clipboard` HOT 2
- image support? HOT 1
- Only write permissions version HOT 3
- Using clippy across multiple components does not propagate changes to the clipboard of each component
- modal with useClippy in it scrolls the page HOT 1
- Failed to copy with DOMException document not focused in latest firefox / chrome.
- Disable reading from clipyboard. HOT 1
- React version dependency HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from use-clippy.