chromium/third_party/blink/web_tests/fast/events/keypress-removed-node.html

<p>This test verifies that a node does not retain keyboard focus after it has
been removed from the DOM.</p>
<hr>
<input type="text">
<pre id="console">PASS: did not get keyboard event.</pre>

<script>
if (window.testRunner)
    testRunner.dumpAsText();
    
input = document.getElementsByTagName('input')[0];
input.focus();
input.onkeypress = function() { 
    document.getElementById('console').innerHTML = "FAIL: got keyboard event.\n"
}

input.parentNode.removeChild(input);

if (window.eventSender)
    eventSender.keyDown("A");
else
    document.getElementById('console').innerHTML = "This test only runs from DumpRenderTree.\n"
</script>