JSFiddle - React, Tailwind, and code Playground
HTML
<input>
<br><br>
<button>New doc and print</button>
<br><br>
<p>
Reproduction steps
</p>
<ol>
<li>Click on "New doc and print" button</li>
<li>When the print previw appears, just close it using ctrl-w (not the save / print / cancel buttons)</li>
<li>Attempt to click on the <code>input</code> element</li>
<li>It won't gain focus</li>
</ol>
JavaScript
document.querySelector('button').addEventListener('click', function () {
var win = window.open('', '');
win.document.close();
win.document.body.innerHTML = 'My life has been a tapestry';
win.print(); // blocking - so close will not
win.close(); // execute until this is done
});