I want to have a button to paste some text (from the clipboard) into an input field.
The following snippet works in Chromium, but not in Firefox.
<input>
<button>paste</button>
<script>
document.querySelector('button').addEventListener('click', () =>
navigator.clipboard.readText().then(text => document.querySelector('input').value = text)
);
</script>
Is there a way to achieve the same effect in Firefox?
Firefox 74+ have hidden testing experiment: dom.events.testing.asyncClipboard