You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first attempt to copy the content of an input content fails because somehow when document.body.appendChild(mark) is called in copy() the selection is not null.
Instead the type in selection.type is set to Caret and so the rangeCountis equal to 1. Which, I suppose, made addRange fails due, I suppose again, to this error in my console:
I have the similar problem. It occurs very rarely. In most cases - after login in and using the copy() function for the first time. Chrome gives me a message: "[Deprecation] The behavior that Selection.addRange() merges existing Range...". After that I can successfully copy text to clipboard.
I've fixed it by adding before the copy('Text') next lines: const select = window.getSelection(); select.removeAllRanges();
I have a very specific issue in Chrome.
The first attempt to copy the content of an input content fails because somehow when
document.body.appendChild(mark)
is called incopy()
the selection is not null.Instead the type in selection.type is set to
Caret
and so therangeCount
is equal to 1. Which, I suppose, made addRange fails due, I suppose again, to this error in my console:If I click somewhere in my input before the copy, it works. Don't know what's the mess with the caret?!
I'm on a mac and it works in safari. Also I'm using copy-to-clipboard through react-copy-to-clipboard.
Thanks
EDIT: As a work around I put a autofocus on the input field and it works.
The text was updated successfully, but these errors were encountered: