Focus after confirm/alert not returned to document/window

Press any key, confirm or cancel the confirm, press any key again click on the document first, press any key again, confirm or cancel the confirm, press any key again click on the document first, press any key again, confirm or cancel the confirm, press any key again click on the document first, press any key again, ...

What it should do: each keystroke after the other should trigger a confirm, without any other (manual) intervention