I think I have a fix for the textbox input losing focus. Just a few lines in the html/Javascript.
In the body:
<body onblur= go_focus();>
And in the Javascript part:
function go_focus(){
document.getElementById("textbox").focus();
}
Doing a self.focus() or window.focus() doesn't seem to work.
Edit: applying the same code to some more complex plugins doesn't seem to work...