Open
Description
It failed to copy to clipboard with DOMException document not focused in latest firefox / chrome.
It seems to me the root clause is at the
Line 112 in 4a92a6c
It seems it works if I restore the original focus:
const write = (text: string): void => {
const textArea: HTMLTextAreaElement = createTextArea();
const curActiveElement = document.activeElement as HTMLElement
textArea.value = text;
textArea.select();
const success: boolean = document.execCommand('copy');
removeElement(textArea);
if(curActiveElement) curActiveElement.focus()
if (!success) {
throw NOT_ALLOWED_ERROR;
}
};
I guess similar problem exists for reading the clipboard but I did not use / test it.
Metadata
Metadata
Assignees
Labels
No labels