Calling a JavaScriptFunction steals focus

I’ve made a function to remote control an external window, opended with BrowserWindowOpener.
The external Window contains just a RichtextField. The function automatically closes the external window if the user clicks a button in the main app.

The remote control is implemented by using a heartbeat function for the external UI:

Page.getCurrent().getJavaScript().addFunction(“checkState”, checkStateJsFunction);
javaScript.execute(“window.setInterval(function(){checkState;}, 1000);”);

This calls every 1 second the checkStateJsFunction witch checks if the close button has been triggered and calls javascript.execute(“window.close();”) if so.

But there is a problem. The internal callback to the registered checkStateJsFunction steals the focus (every second). This is very anoying while typing in the RichTextField.

If i replace the interval function with “console.log(‘foo’);” the focus is not getting stealed, so it seems to be the fault of the vaadin callback.

Is this a VAADIN bug?