Unable to copy database to clipboard in Chome
See original GitHub issueWhen trying to save my DB to the clipboard in this page, I press the button, the alert box comes up saying Copied database to clipboard
but nothing is actually saved to the clipboard.
In the console the following error occurs:
Uncaught (in promise) DOMException: Document is not focused.
It works fine in Firefox and Safari, but not Chrome.
I don’t understand the error, if I’m pressing the button -> the button is focused -> the document should be focused too no? So what’s up?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Fix Copy and Paste Not Working in Chrome - Technipages
If you can't use the copy-paste option in Chrome, disable your extensions, clear the cache and update the browser. On the other hand, ......
Read more >Your Browser Can't Access the Clipboard [Multiple Devices ...
The quickest way to fix this issue is to check if clipboard copying works in a different browser. Alternatively, you can try using...
Read more >Unable to paste links in chrome text boxes - Google Support
The workaround is instead of tapping on Copy icon you need to tap on Share icon. And, tap on the "Copy Link" icon...
Read more >Unblocking clipboard access - web.dev
Async Clipboard API simplifies permissions-friendly copy and paste.
Read more >Copy to Clipboard in Chrome Extension - Stack Overflow
I'm making an extension for Google Chrome and I have hit a snag. I need to copy a readonly textarea's content to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Pustur Sorry for the late reply, I had to prioritize time on more critical features. What a surprise for me to find the solution already waiting for me. The problem is resolved as of
v6.0.13
.If you want more up-to-date responses to bugreports, I’ll advice you to join the Genshin Optimizer Discord, where I stage most of the feature requests/bugreports/discussions.
Thanks a lot for your help!
Ok I think I understand the problem now.
In this code:
https://github.com/frzyc/genshin-optimizer/blob/ce5919de268b61179c811e0882b57951170f06a0/src/Settings/SettingsDisplay.tsx#L93-L94
You try to copy the DB to the clipboard and then alert right after it. The alert is actually the thing that’s responsible for the error! It basically steals the focus from the document so the clipboard operation fails. (apparently this focus problem only occurs on Chrome + macOS for some reason)
Instead the correct code would be:
So the alert is only shown once the clipboard has been written to successfully.