Clipboard API Ctrl+V double-paste repro (SVRN-1769)

Each target below registers a Ctrl+V keydown handler that calls preventDefault() on the keydown and then reads the clipboard via navigator.clipboard.readText(), appending the result to the target with the prefix [readText]. This mirrors how xterm.js handles paste in the VS Code Web / Codespaces integrated terminal.

The three targets differ only in their paste event handler:

Expected post-fix behavior, after a single Ctrl+V on each target with the source text PASTE_ME on the clipboard:

Pre-fix, the surrogate also synthesizes a paste event after the clipboard permission is granted. That synthesized event runs the page's paste handler and, unless the page calls preventDefault on it, also performs the browser's default paste action (inserting the text into the focused contenteditable). So pre-fix you'd see PASTE_ME appearing twice or three times depending on which target.

Source to copy from: