diff --git a/ui/src/utils/copy-to-clipboard.js b/ui/src/utils/copy-to-clipboard.js index c951828413b..dc08959b429 100644 --- a/ui/src/utils/copy-to-clipboard.js +++ b/ui/src/utils/copy-to-clipboard.js @@ -1,9 +1,15 @@ + +import { addFocusout, removeFocusout } from './private/focusout.js' + function fallback (text) { const area = document.createElement('textarea') area.value = text area.contentEditable = 'true' area.style.position = 'fixed' // avoid scrolling to bottom + const fn = () => {} + addFocusout(fn) + document.body.appendChild(area) area.focus() area.select() @@ -11,6 +17,8 @@ function fallback (text) { const res = document.execCommand('copy') area.remove() + removeFocusout(fn) + return res }